rabbitmq - How to hold Mule process until JMS consume complete processing -
i have jms in mule flow producer reads records cache, put in queue , consumer consumes messages , further processing. following flow understanding.
service 1 (read data file) -> service 2 (put each line in cache) -> jms service 3 (producer read data cache line line , put in queue) , consumer read queue -> service 4
in above flow, jms component, flow becomes asynch hence producer puts records in queue response goes client saying process completed possible consumer still going consume messages.
i want hold process producer send response until consumer consumes messages.
any idea on how achieve?
since async takes copy of exact thread , process independently, may possible producer putting message in queue fast before consumer able consume it.
1 way can think hold process of putting message queue putting sleep()
before it.
can use groovy component , use sleep()
in hold flow or slow down process.
example, if put following:
<scripting:component doc:name="groovy"> <scripting:script engine="groovy"><![cdata[ sleep(10000); return message.payload;]]> </scripting:script> </scripting:component>
before putting message queue, process slow down bit , hold flow 10000 ms till on other side consumer consume it.
Comments
Post a Comment