When I post a message to a component which will give me a distinct out
message (like http, jdbc, etc.), what is the best way to continue processing
both the in and out messages in parallel? In other words, how can I send the
response message (out) on a separate thread while I continue the initial
route with the request message (in)?
The scenario we are trying to handle is as follows. We receive a customer
file, for which we generate several receipt reports which are sent back to
the customer. Those reports are to be sent back as soon as they are
generated while the original inbound file continues through the processing
cycle.
pseudo-route would look like this in theory:
From("file:")
.to("http:validateFileAndGenerateReceiptReport1")
.to("file:report1.txt")
.to("http:validateFileAndGenerateReceiptReport2")
.to("file:report2.txt)
.to(...further processing of inbound file")
Of course this does not work for the original inbound file data iss
overwritten with the first HTTP response which is not what we need.
I know we could just backup the inbound data into a temporary header
property before calling the HTTP components and then restore it into the
body later in the route before calling the second HTTP component but I was
wondering if there is a cleaner way to accomplish this.
We are planning on doing something like this unless you have a better
solution:
From("file:")
.setHeader(request, in.body)
.to("http:validateFileAndGenerateReceiptReport1")
.to("file:report1.txt")
.setBody(header(request))
.to("http:validateFileAndGenerateReceiptReport2")
.to("file:report2.txt)
.setBody(header(request))
.to(...further processing of inbound file")
--
View this message in context:
http://camel.465427.n5.nabble.com/How-to-process-a-response-and-the-original-message-after-submitting-to-a-component-tp5737841.html
Sent from the Camel - Users mailing list archive at Nabble.com.