我需要使用事件驱动机制。使用ApplicationEventPublisher
。在到达侦听此事件的端点之前,我希望为消息设置一个延迟。有这样的方法吗?找到了https://docs.spring.io/spring-integration/docs/2.0.0.RC1/reference/html/delayer.html,但不确定它应该如何与ApplicationEventPublisher集成。
是否有一种简单的方法来使用spring来实现上述目标?
发布于 2017-10-30 05:27:47
除了Delayer
之外,Spring还根据传入的消息向生产者提供到ApplicationEventPublisher
的ApplicationEvent
。这样,您实际上将延迟<delayer>
中的消息(一个事件),然后通过<int-event:outbound-channel-adapter>
将一个事件发布到应用程序。
还考虑使用尽可能晚的Spring版本:https://projects.spring.io/spring-integration/
https://stackoverflow.com/questions/47010869
复制