java—如果消息发送失败,如何在rabbitmq中设置/限制重试次数?

gmol1639  于 2021-07-12  发布在  Java
关注(0)|答案(1)|浏览(460)

我正在使用rabbitmq,并且我有一个保存消息的队列。如果消息失败,将进行3次尝试。我想把次数限制为1次,这样我就可以再次发送消息。我还有别的办法吗?提前谢谢。

bindings:
    documentrequest-policyinqadapter:
      destination: PI-DocumentRequestService-AdapterService-Exchange
      group: dcsnt-policyinquiryadapter-documentrequest-processessor
  rabbit:
    bindings:
      documentrequest-policyinqadapter:
        producer:
          routing-key-expression: headers['events-type']
        consumer:
          autoBindDlq: true
          republishToDlq: true
          default-requeue-rejected: false
          bindingRoutingKey: documentrequest.adapter.*.*.*.policyinq.req
          deadLetterQueueName: pi-adapter-dead-letter-queue
          deadLetterExchange: PI-DocumentRequestService-AdapterService-Exchange-dlx
          deadLetterRoutingKey: documentrequest.adapter.*.*.*.policyinq.req
          maxAttempts: 1
          maxConcurrency: 10
3zwjbxry

3zwjbxry1#

maxAttempts 是所有绑定器共用的使用者绑定属性。
https://docs.spring.io/spring-cloud-stream/docs/3.1.2/reference/html/spring-cloud-stream.html#_consumer_properties
您已经将其定义为兔子特定的绑定属性。
向上移动。

相关问题