【发布时间】:2018-02-25 12:40:14
【问题描述】:
我正在构建一个系统,该系统将通过消息代理(当前为 JMS)接收来自不同系统的消息。来自所有发送者系统的所有消息都有一个 deviceId,并且消息的接收没有顺序。 例如,系统 A 可以发送 deviceId=1 的消息,系统 b 可以发送 deviceId=2 的消息。
我的目标是不开始处理有关同一 deviceId 的消息,除非我从所有具有相同 deviceId 的发件人那里收到所有消息。
例如,如果我有 3 个系统 A、B 和 C 向我的系统发送消息:
System A sends messageA1 with deviceId=1
System B sends messageB1 with deviceId=1
System C sends messageC1 with deviceId=3
System C sends messageC2 with deviceId=1 <--- here I should start processing of messageA1, messageB1 and messageC2 because they are having the same deviceID 1.
是否应该通过在我的系统中使用某种同步机制、消息代理或 spring-integration/apache camel 等集成框架来解决此问题?
【问题讨论】:
-
服务是否从其中一个系统接收到几条具有相同 deviceId 的消息?您想一一处理单独的消息吗?示例(deviceId=1):
messageA1, messageA1, messageA1, messageC1, messageC1, messageB1-> 进程已启动 -
不,没关系......重要的是当所有3条消息都到达时触发处理,因为它们包含我必须处理的数据
标签: java design-patterns apache-camel spring-integration integration-patterns