1
votes

How can one ensure in Spring Cloud Stream Rabbit guaranteed delivery. My code below : -

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
  }
}

Any help is appreciated.

1

1 Answers

1
votes

You can use the Rabbit consumer property spring.cloud.stream.rabbit.bindings.<channelName>.consumer.acknowledgeMode on how do you want to acknowledge. The acknowledgeMode comes from Spring AMQP and you can refer more documentation on this here