I have application with web service interface which developed using camel on JBoss FUSE and I am saving the receiving messages in to Database without any issue. But now I need to enhance it to do some time consuming processes such as web service invocations.
My Idea is to add that receiving message in to MessageQueue and then send the web service call response. Then to do the time consuming process by reading the message queue. But my problem is whether it's possible to have background route running in camel to do such implementation.
I try to implement it using multicast but in there it's waiting until all the routes completed.
Below diagram shows the thing that I try to archive.
My problem is is it possible to send the response from route 1 before finishing the route two? If its possible how can I archive it using camel ?
I'm quite new to Camel development and I would like to know whether it's possible to accomplished above scenario. Please be kind enough to provide feedback about this ?
It's possible to do by using Wire-Tap. As show on below
<route id="initialRequest">
<from uri="bean:webService" />
<to uri="database:saveData" />
<wireTap uri="activemq:queue:queueName" />
...continue your respond send process
</route>
<route id="BackgroundLongProcess">
<from uri="activemq:queue:queueName" />
... Do the required time consuming process
</route>
Then the BackgroundLongProcess will execute but initialRequest route will not wait until BackgroundLongProcess process finish. You can refer to the camelone documentation for more details.