Spring Cloud Stream Rabbit Delivery确认

时间:2017-06-07 15:39:58

标签: spring rabbitmq spring-rabbit spring-cloud-stream

如何确保Spring Cloud Stream Rabbit保证交付。我的代码如下: -

class Source {
    MessageChannel output;
    Repository repo;

    @Transactional
    void publisher(Command command){
      repo.save(command);
      output.send(MessageBuilder
                .withPayload(new Event()).build());
    }
}

class Sink {

  @StreamListener(Event.class)
  void eventListener(Event event){
     // method body
  }
}

感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

您可以使用Rabbit使用者属性spring.cloud.stream.rabbit.bindings.<channelName>.consumer.acknowledgeMode来确认您的身份。 acknowledgeMode来自Spring AMQP,您可以参考这个here

的更多文档
相关问题