简体   繁体   中英

Block route until consumer receives message

I have a route like this:

[producer1]--->[blocker]--->                 
                           |--->[aggregator]---> [consumer]
[producer2]---------------->

Producer1 and producer2 are pushing messages to the aggregator . If there are two messages with the same id then the aggregation is completed and the aggregated message will be routed to a consumer.

Is it possible to block the route after the producer1 sends a message to the aggregator ? Something like wait until the consumer receives the aggregated message .

No this is not possible as the aggregator is two-legged. So what goes out of the aggregator is not linked to what goes in.

You can however build a java bean and use a CountDownLatch and then block after you have called the aggregator, and then signal a count down when you have an outgoing message from the aggregator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM