2017-06-07 44 views
1

如何確保Spring Cloud Stream Rabbit保證交付。我的代碼如下: -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

您可以使用兔子消費者屬性spring.cloud.stream.rabbit.bindings.<channelName>.consumer.acknowledgeMode您要如何確認。 acknowledgeMode來自Spring AMQP,你可以參考更多關於這個here

+0

的文檔謝謝,如果消息失敗,生產者重試和多久? – aprofromindia

+0

不知道生產者重試是什麼意思,因爲我指的是消費者方面的acknowledgeMode。如果您的意思是在消費者方面重試,您可以參考此文檔:http://docs.spring.io/spring-cloud-stream/docs/Chelsea.BUILD-SNAPSHOT/reference/htmlsingle/index.html#_retry_with_the_rabbitmq_binder –

相關問題