Hello, i'm testing an application that sends messages through some routes
defined in the camel-context as it follow: 


               <camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring";>
                

                
                <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" />

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

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

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

            msgHeader = new MessageHeader ("headerEvent", "MTT");
            msgHeader2 = new MessageHeader("headerEvent", "CASH");
            msgBody = new MessageBody ("body");
            mBM = MessageBrokerManagerImpl.getInstance(prop);
            mBM.startRoutingEngine();
           
            for(int i = 0; i<50;i++){
                if(i < 25){
                        
mBM.sendHeaderAndBodyToEndPoint("message-inTo-filter",msgBody ,
msgHeader);
                        
                }else{
                        
                        
mBM.sendHeaderAndBodyToEndPoint("message-inTo-filter",msgBody ,
msgHeader2);
                }
            }
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
others.
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 ,
msgHeader);
                        
                }............

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.
Fabrizio.

--
View this message in context: 
http://camel.465427.n5.nabble.com/MOCK-Problem-it-gets-half-of-the-messages-it-suppose-to-receive-tp5119702p5119702.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to