简体   繁体   English

Spring Boot + RabbitMQ 消息在延迟交换时丢失

[英]Spring Boot + RabbitMQ messages lost on delayed exchange

我正在使用 spring boot convertAndSend()在延迟交换上发布消息,但该消息从未在队列中发布,也没有抛出任何异常

is never being published on the queue and there isn't any exception being thrown永远不会在队列上发布,也没有抛出任何异常

When a system wants to communicate via a message broker the developer needs a clear understanding of the delivery semantics.当系统想要通过消息代理进行通信时,开发人员需要清楚地了解交付语义。 At first one needs to know if and how often a message will be delivered to the broker (and potential consumers):首先需要知道消息是否以及多久发送给代理(和潜在消费者):

  1. At most once – the message is delivered at most once but also not at all.最多一次 - 消息最多传递一次,但也不会传递。
  2. At least once – the message guaranteed to be delivered but can be delivered multiple times.至少一次——消息保证被传递,但可以多次传递。
  3. Exactly once – the message is guaranteed to be delivered exactly once. Exactly once – 消息保证只传递一次。

The reasons why your messages are lost is because probably you are using at most once semantics.您的消息丢失的原因可能是您at most once使用at most once语义。

You can configure at least once delivery semantics if you follow this guide如果您遵循本指南,您可以at least once配置at least once交付语义

Does this solve your problem ?这能解决您的问题吗? Tell me in the comments.在评论中告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM