2

Hi I am using camel and have an ordering issue to tackle where I don't want the same transaction or group to be processed parallely in multiple threads to resolve the same I am planning to use the JMSXGROUPID header http://camel.apache.org/parallel-processing-and-ordering.html to resolve the same.My question was can this be used with threads tag/dsl

<route id="consumer" autoStartup="true">
        <description>processing route</description>
        <from uri="direct:consumer" />
        <!-- <log message="Received ${body}:${threadName}" /> -->
        <threads executorServiceRef="sfIboundThreadPool">
            <log message="Got ${body}:${threadName} for processing" marker="CAMELLOG" />
            <setProperty propertyName="step">
                <simple>reader</simple>
            </setProperty>
            <process ref="reader" />

the multiple threads spawned here are using a theadpool configured .My querstion was witll these threads use JMSXGROUPID if I place the header to messages going to the consumer route.

1 Answer 1

3

Read about JMS message groups here

When using that, they are guaranteed to be sequential processed from the same group. But you can process multiple groups in parallel.

So you do not need to use Camel's threads, just configure the JMS/ActiveMQ endpoint to use concurrentConsumers and you get this much easier out of the box.

3
  • thanks for this is there an option I can do such sequential processing for groups in a concurrent setup like threads or seda without using JMS/ActiveMQ if possible ? Jun 28, 2015 at 8:58
  • JMSGroupID is JMS and you would need to use that, as its on the broker side its implemented. Without JMS you can implement your own priority thread pool or something like that Jun 28, 2015 at 11:01
  • thanks @claus_ibsen finally solved it using a map to cache items before I multicast them worked for my use case .But yest will go for active mq if I need better sequential processing in a concurrent setup Jul 2, 2015 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.