Hello, The way you see it behave is the way it should behave. If you have competing consumers on a queue they will consume messages in that way.
If I interpreted your requirement correctly you have messages from a# that can only be consumed by c# and messages from b# that can only be consumed by d#. In that case you should really use two different queues for this one between each pair of producer and consumer. Adding extra queues in activemq is simple and very low cost when it comes to resources. So I would advice you to solve it this way. If you for some reason still want to use one queue (legacy, crazy customer requirement or let's say that you are building a example for bad architecture ;-P) then you can set a header on the messages in the producer and then use a selector in the consumer. See the documentation on the Camel JMS component[1] and the JMS component unit test. But again: Use two queues. [1] http://camel.apache.org/jms.html [2] https://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSelectorTest.java Best regards Pontus Ullgren On Wed, Sep 12, 2012 at 7:18 PM, garrydias <garryd...@gmail.com> wrote: > Dear friends > > I´m facing the folowing problem: I have 2 producers systems sending messages > to 1 jms queue that is consumed by 2 consumers systems. Ignore the VM where > they are. > > #a) a producerSystem_1.war has the folowing camelContext: > > <camelContext id="producerSystem-1-camelContext"> > ... > <route> > <from uri="direct:whatever" /> > <to uri="activemq:common_queue" /> > </route> > ... > </camelContext > > > > #b) a producerSystem_2.war has the folowing camelContext: > > <camelContext id="producerSystem-2-camelContext"> > ... > <route> > <from uri="direct:whatever" /> > <to uri="activemq:common_queue" /> > </route> > ... > </camelContext > > > > #c) a consumerSystem_1.war has the folowing camelContext: > > <camelContext id="context_1"> > <route> > <from uri="activemq:common_queue" /> > <to uri="bean:consumer_a" /> > </route> > </camelContext > > > > #d) a consumerSystem_2.war has the folowing camelContext: > > <camelContext id="context_2"> > <route> > <from uri="activemq:common_queue" /> > <to uri="bean:consumer_b" /> > </route> > </camelContext > > > > The VM where these applications are running is not important. > > My *desired behavior *is: > - Messages produced in #a must consumed in c# > - Messages produced in #b must consumed in d# > > The *actual behavior* is: > - Messages produced in #a sometimes is consumed in c# and sometimes in d# > - Messages produced in #b sometimes is consumed in c# and sometimes in d# > > I understand that JMS endpoints were designed to execute in the *actual > behavior*. But in this case, I need to run *my desired *behavior. > > There´s a way to do this using correlationIds (not send/receive approach)? > > Thanx a lot > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Using-correlationid-to-isolate-jms-queues-in-multiple-camelContexts-tp5719202.html > Sent from the Camel - Users mailing list archive at Nabble.com.