Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Spring云流中使用默认死信队列的消息?_Java_Spring_Spring Boot_Rabbitmq_Spring Cloud Stream - Fatal编程技术网

Java 如何在Spring云流中使用默认死信队列的消息?

Java 如何在Spring云流中使用默认死信队列的消息?,java,spring,spring-boot,rabbitmq,spring-cloud-stream,Java,Spring,Spring Boot,Rabbitmq,Spring Cloud Stream,我将默认DLQ配置如下: spring: cloud: stream: rabbit: default: consumer: auto-bind-dlq: true republish-to-dlq: true dead-letter-queue-name: my-dlq 我想使用默认DLQ中的消息,并在业务域中处理它 如何使用Spring Cloud Strea

我将默认DLQ配置如下:

spring:
  cloud:
    stream:
      rabbit:
        default:
          consumer:
            auto-bind-dlq: true
            republish-to-dlq: true
            dead-letter-queue-name: my-dlq
我想使用默认DLQ中的消息,并在业务域中处理它

如何使用Spring Cloud Stream收听这些消息


谢谢

没有内置功能,但是

因为您无法预测用户希望如何处理死信消息,所以该框架没有提供任何标准机制来处理这些消息。如果死信的原因是暂时的,您可能希望将消息路由回原始队列。但是,如果问题是一个永久性问题,则可能会导致无限循环。下面的Spring引导应用程序演示了如何将这些消息路由回原始队列,但在三次尝试后将它们移动到第三个“停车场”队列。第二个示例使用RabbitMQ延迟消息交换为重新排队的消息引入延迟。在此示例中,每次尝试的延迟都会增加。这些示例使用@RabbitListener从DLQ接收消息。您还可以在批处理过程中使用rabbitmplate.receive()


非常感谢。我正在寻找一种使用
StreamListener
来听他们讲话的方法。据我所知,我必须使用
RabbitListener
。您可以使用
StreamListener
,但您需要自定义配置绑定,如前所述。