Spring 集成:Publish/Subscribe:有没有一种方法可以让订阅者为它排队等待消息,即使它暂时处于非活动状态?

Spring Integration: Publish/Subscribe: Is there a way for a subscriber to have messages queued for it even if it is temporary inactive?

场景如下:我有一个发送消息的发布者和一个订阅者宕机了。如何确保订阅者在消息恢复后仍能收到消息?

使用 QueueChannel (in-memory) 或由代理(RabbitMQ、Kafka、JMS 等)支持的一个。

在两者之间使用 QueueChannel。这样,发布的消息将停放在队列中,直到您启动消费者轮询该队列。

有关详细信息,请参阅文档:https://docs.spring.io/spring-integration/docs/current/reference/html/core.html#channel-implementations-queuechannel