...
Div | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
Notice that some Camel Components has their own implementation of PollingConsumer
and therefore do not support the options above.
...
With the Spring DSL we can declare the consumer in the CamelContext with the consumerTemplate tag, just like the ProducerTemplate. The example below illustrates this:
Wiki Markup |
---|
{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringConsumerTemplateTest-context.xml} |
ConsumerTemplate
in our java class. The code below is part of an unit test but it shows how the consumer and producer can work together.Wiki Markup |
---|
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/SpringConsumerTemplateTest.java} |
Timer based polling consumer
...
First we setup our route as:
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=camel/tags/camel-2.6.0/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTimerBasedPollingConsumerTest.java} |
Wiki Markup |
---|
{snippet:id=e2|lang=java|url=camel/tags/camel-2.6.0/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTimerBasedPollingConsumerTest.java} |
Scheduled Poll Components
...