Question

I am using a multicast in Camel DSL because I need to send a copy of the same message to two different endpoints. However, it seems that the routes are interfering with each other. Have I got the syntax wrong, or some other issue?

from("{{in.endpoint}}")
    .routeId(this.getClass().getSimpleName())
    .multicast().parallelProcessing()
        .to("{{update.in}}", "{{add.ibmmq.topic}});

where

in.endpoint = seda:addOrder?waitForTaskToComplete=Never
update.in = seda:updateData?waitForTaskToComplete=Never
add.ibmmq.topic = an ibmmq topic

I expect the 'update' route to receive the 'in' message, and the 'ibmmq topic' to receive the same message, presumably cloned. However, in the logs I am getting exceptions like:

Exchange[
Id                  ID-slon12d10628-1228-1386074869307-0-44746
ExchangePattern     InOnly
Headers             {breadcrumbId=ID-slon12d10628-1228-1386074869307-0-41682, calendar=null, CamelMyBatisResult=[integration.model.EInquiry@19eb77c, integration.model.EInquiry@12059ce, xxxxxxx
BodyType            message.BulkAddOrderMsg
Body                message.BulkAddBondOrderMsg@77df22
]

but the EInquiry objects are read in by a completely separate route, nothing to do with this route except it, too, sends messages to 'in.endpoint'.

The other thing is because I read from Tibco and send to IBMMQ, I have to clear the JMS header codes because they are not compatible, so I have put:

exchange.getIn().getHeaders().clear();

in my 'update' route. Could this be clearing Camel's exchange tracing headers and causing this issue, basically like some weird concurrency issue?

No correct solution

OTHER TIPS

Its hard to find the error without full source code, but bear in mind that multicast does not do deep copy.

If you have child objects in the Order object they are not duplicated and they are shared between both SEDA routes.

Probably you will have to make a custom deep clone of the object

The body of your Exchange is a custom POJO: message.BulkAddBondOrderMsg@77df22... which means there is no deep cloning available unless you add it. Same thing would happen if the body were DOM XML node...

Serialize the POJO to a String prior to the multicast so it can be shared across Exchanges.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top