When using a consumer template to receive messages from seda queue, a single
receiveBody (or receiveBodyNoWait) seems to consume more than one message
from the queue. Here is a sample processor:
SedaEndpoint queueEp = (SedaEndpoint)
exchange.getContext().getEndpoint("seda:test");
ConsumerTemplate cTemplate = (ConsumerTemplate)
exchange.getContext().getRegistry().lookupByName("cTemplate");
System.out.println("seda queue size before receive: " +
queueEp.getExchanges().size());
String msgBody = cTemplate.receiveBody(queueEp, 10, String.class);
System.out.println("seda queue size after receive: " +
queueEp.getExchanges().size());
The output is the following:
seda queue size before receive: 5
seda queue size after receive: 0
Should the receiveBody receive one message each time? The above processor
is running under a single Camel Timer thread. Here are the routes (the
above code is in testProc):
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:consumerTemplate id="cTemplate" />
<camel:route>
<camel:from uri="file:src/data?noop=true"/>
<camel:to uri="seda:test" />
</camel:route>
<camel:route>
<camel:from uri="timer://foo?period=500000" />
<camel:process ref="testProc"/>
</camel:route>
</camel:camelContext>
Have I missed anything? Thanks for any help!
--
View this message in context:
http://camel.465427.n5.nabble.com/Why-does-ConsumerTemplate-receiveBody-receive-more-than-one-message-at-a-time-from-SEDA-queue-tp5745568.html
Sent from the Camel - Users mailing list archive at Nabble.com.