gpt4 book ai didi

java - 有没有办法在 Spring 中使用带有延迟事件的 ApplicationEventPublisher ?

转载 作者:行者123 更新时间:2023-12-02 12:04:21 29 4
gpt4 key购买 nike

我需要使用事件驱动机制。使用ApplicationEventPublisher。我想在到达监听此事件的端点之前为消息设置延迟。有这样的办法吗?找到https://docs.spring.io/spring-integration/docs/2.0.0.RC1/reference/html/delayer.html但不确定它应该如何与 ApplicationEventPublisher 集成。

有没有简单的方法使用spring来实现上述功能?

最佳答案

除了 Delayer ,Spring Integration还提供ApplicationEventPublishingMessageHandler发送给生产者ApplicationEventApplicationEventPublisher基于传入的消息。这样你就真的会延迟 <delayer> 中的消息(一个事件)。然后通过<int-event:outbound-channel-adapter>向应用程序发布事件.

还考虑使用尽可能晚的 Spring Integration 版本:https://projects.spring.io/spring-integration/

关于java - 有没有办法在 Spring 中使用带有延迟事件的 ApplicationEventPublisher ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47010869/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com