camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pitfab <>
Subject MOCK Problem: it gets half of the messages it suppose to receive
Date Wed, 04 Jan 2012 14:17:35 GMT
Hello, i'm testing an application that sends messages through some routes
defined in the camel-context as it follow: 

               <camelContext id="camel"

		<endpoint id="message-inTo-filter"
uri="lobby-jms:queue:lobby-filtered.queue" />
		<endpoint id="message-outTo-worker"
			uri="lobby-jms:queue:lobby-event-worker.queue?concurrentConsumers=5" />

			<from uri="message-inTo-filter" />
				<simple>${header.headerEvent} == 'MTT'</simple>

				*<to uri="mock:result" />*				

and here is the class that sends the messages:
	public void testRoutes() throws Exception {

	    msgHeader = new MessageHeader ("headerEvent", "MTT");
	    msgHeader2 = new MessageHeader("headerEvent", "CASH");
	    msgBody = new MessageBody ("body");
	    mBM = MessageBrokerManagerImpl.getInstance(prop);
	    for(int i = 0; i<50;i++){
	    	if(i < 25){
	    		mBM.sendHeaderAndBodyToEndPoint("message-inTo-filter",msgBody ,
	    		mBM.sendHeaderAndBodyToEndPoint("message-inTo-filter",msgBody ,
the problem is that when i set the MOCK component as endpoint i assert that
it should receive 25 msg but it just receive half(13). no track of the
it's strange because if i change the IF like this ---> 
              for(int i = 0; i<50;i++){

	    	if(i%2 ==0 ){
	    		mBM.sendHeaderAndBodyToEndPoint("message-inTo-filter",msgBody ,

the mock receive all the messages. 

The last thing i noticed is that if i set as endpoint an ActiveMQ queue it
works anyway.(no matter the IF).

Sorry if it's not clear..but i would really appreciate any of your suggest.

Thank you.

View this message in context:
Sent from the Camel Development mailing list archive at

View raw message