服务器重启时的聚合器行为 - spring 集成
Aggregator behavior on server restart - spring integration
前提 -
在 spring 集成中,如果我有一个消息组不完整的聚合器。满足组发布策略前,重启服务器
- 当前行为->
发布到聚合器的所有消息都进入同一个消息组而不是新消息组,因为它没有标记为完成,消息不断流入。
- 预期->
如果服务器重新启动,聚合器会从消息存储中选择剩余的消息,将已经保存的消息标记为已完成,然后满足新的消息,
我的期望不正确吗?有人可以指导吗?
我认为我们可以通过 MessageGroupStoreReaper
满足您的要求,您将 运行 在服务器启动时,例如通过捕捉 ContextRefreshedEvent
:
The MessageGroupStore maintains a list of these callbacks which it applies, on demand, to all messages whose timestamp is earlier than a time supplied as a parameter (see the registerMessageGroupExpiryCallback(..) and expireMessageGroups(..) methods above).
The expireMessageGroups method can be called with a timeout value. Any message older than the current time minus this value will be expired, and have the callbacks applied. Thus it is the user of the store that defines what is meant by message group "expiry".
http://docs.spring.io/spring-integration/reference/html/messaging-routing-chapter.html#reaper
前提 -
在 spring 集成中,如果我有一个消息组不完整的聚合器。满足组发布策略前,重启服务器
- 当前行为-> 发布到聚合器的所有消息都进入同一个消息组而不是新消息组,因为它没有标记为完成,消息不断流入。
- 预期-> 如果服务器重新启动,聚合器会从消息存储中选择剩余的消息,将已经保存的消息标记为已完成,然后满足新的消息,
我的期望不正确吗?有人可以指导吗?
我认为我们可以通过 MessageGroupStoreReaper
满足您的要求,您将 运行 在服务器启动时,例如通过捕捉 ContextRefreshedEvent
:
The MessageGroupStore maintains a list of these callbacks which it applies, on demand, to all messages whose timestamp is earlier than a time supplied as a parameter (see the registerMessageGroupExpiryCallback(..) and expireMessageGroups(..) methods above).
The expireMessageGroups method can be called with a timeout value. Any message older than the current time minus this value will be expired, and have the callbacks applied. Thus it is the user of the store that defines what is meant by message group "expiry".
http://docs.spring.io/spring-integration/reference/html/messaging-routing-chapter.html#reaper