[英]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
. Producer1
和producer2
正在推动消息的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. 如果有两个具有相同ID的消息,则聚集完成,并且聚集的消息将被路由到使用者。
Is it possible to block the route after the producer1
sends a message to the aggregator
? 在producer1
向aggregator
发送消息之后,是否可以阻止路由? Something like wait until the consumer receives the aggregated message
. 诸如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. 但是,您可以构建一个Java Bean并使用CountDownLatch,然后在调用聚合器之后进行阻塞,然后在收到来自聚合器的传出消息时发出递减计数的信号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.