Search in sources :

Example 1 with DefaultConsumerTemplate

use of org.apache.camel.impl.DefaultConsumerTemplate in project camel by apache.

the class CamelContextAwareTest method testCamelTemplates.

public void testCamelTemplates() throws Exception {
    DefaultProducerTemplate producer1 = getMandatoryBean(DefaultProducerTemplate.class, "producer1");
    assertEquals("Inject a wrong camel context", producer1.getCamelContext().getName(), "camel1");
    DefaultProducerTemplate producer2 = getMandatoryBean(DefaultProducerTemplate.class, "producer2");
    assertEquals("Inject a wrong camel context", producer2.getCamelContext().getName(), "camel2");
    DefaultConsumerTemplate consumer = getMandatoryBean(DefaultConsumerTemplate.class, "consumer");
    assertEquals("Inject a wrong camel context", consumer.getCamelContext().getName(), "camel2");
}
Also used : DefaultConsumerTemplate(org.apache.camel.impl.DefaultConsumerTemplate) DefaultProducerTemplate(org.apache.camel.impl.DefaultProducerTemplate)

Example 2 with DefaultConsumerTemplate

use of org.apache.camel.impl.DefaultConsumerTemplate in project camel by apache.

the class ConsumerTemplateAutoRegisterTest method testHasTemplate.

@Test
public void testHasTemplate() {
    assertNotNull("Should have injected a consumer template", template);
    assertNotNull("The template context should not be null", ((DefaultConsumerTemplate) template).getCamelContext());
    ConsumerTemplate lookup = context.getRegistry().lookupByNameAndType("consumerTemplate", ConsumerTemplate.class);
    assertNotNull("Should lookup consumer template", lookup);
}
Also used : ConsumerTemplate(org.apache.camel.ConsumerTemplate) DefaultConsumerTemplate(org.apache.camel.impl.DefaultConsumerTemplate) Test(org.junit.Test)

Example 3 with DefaultConsumerTemplate

use of org.apache.camel.impl.DefaultConsumerTemplate in project camel by apache.

the class AbstractCamelConsumerTemplateFactoryBean method getObject.

public ConsumerTemplate getObject() throws Exception {
    template = new DefaultConsumerTemplate(getCamelContext());
    // set custom cache size if provided
    if (maximumCacheSize != null) {
        template.setMaximumCacheSize(maximumCacheSize);
    }
    // must start it so its ready to use
    ServiceHelper.startService(template);
    return template;
}
Also used : DefaultConsumerTemplate(org.apache.camel.impl.DefaultConsumerTemplate)

Aggregations

DefaultConsumerTemplate (org.apache.camel.impl.DefaultConsumerTemplate)3 ConsumerTemplate (org.apache.camel.ConsumerTemplate)1 DefaultProducerTemplate (org.apache.camel.impl.DefaultProducerTemplate)1 Test (org.junit.Test)1