Direct Processing in Apache Camel

I'm interested in finding the best way to do it straight through processing in Apache Camel.

I have several different components that I can run in the same JVM, which is separate from my activemq broker. Does it make sense to try and configure it so that my messages pass from one component to another in order to block? How can I configure camel so that every message hits every component along the route before the next message starts?

To be more specific: I would like to do this via my brokerURI config or something. I saw this page: http://fusesource.com/wiki/display/ProdInfo/Understanding+the+Threads+Allocated+in+ActiveMQ but I'm not sure where / how to implement the parameters - optimizedDispatch seemed to work with broker options destinationPolicy.

thank

+3


source to share


1 answer


to run, explicitly configure one user in your routes consuming from queues ...

globally for all connections

<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="pooledConnectionFactory"/>
    <property name="concurrentConsumers" value="1"/>
    <property name="maxConcurrentConsumers" value="1"/>
</bean>

      

or explicitly for route / consumer

 from("activemq:queue:input?concurrentConsumers=1&maxConcurrentConcumers=1")...

      



then you have several options. Typically, you should use a pipeline pattern to pass messages between steps (synchronously) in the same route. Or, use camel-direct to ensure that messages flow synchronously across multiple routes.

from("activemq:queue:input?concurrentConsumers=1&maxConcurrentConcumers=1")
    .to(<step1>)
    .to(<step2>)
    ...

      

or if your steps require multiple routes, then connect them using direct ...

from("activemq:queue:input?concurrentConsumers=1&maxConcurrentConsumers=1")
    .to("direct:step1");

from("direct:step1")
    //perform step1 processing
    .to(direct:step2");

from("direct:step2")
    //perform step2 processing
    .to(direct:step3");
...

      

+5


source







All Articles