我有一对camel路由,它们从两个不同的队列接收消息,这两个队列的流程由相同的bean (通过引用)执行。这是通过Spring & Camel XML完成的。
配置如下所示:
<route id "route-1" xmlns="http://camel.apache.org/schema/spring">
<from uri="queue:IN1" />
<process ref = "myProcessBean />
</route>
<route id "route-2" xmlns="http://camel.apache.org/schema/spring">
<from uri="queue:IN2" />
<process ref = "myProcessBean />
</route>如果我同时在IN1和IN2上收到消息,这些消息是否会被并行处理?
发布于 2019-07-20 04:07:45
是的会的。处理器是一个单例bean,它可以并行处理。只需确保它不在其中存储任何状态信息,这实际上是建议的最佳实践之一(下面的链接)。
https://www.3riverdev.com/apache-camel-processors-should-never-be-stateful/
https://stackoverflow.com/questions/57113754
复制相似问题