[英]Spring cloud stream - RabbitMQ configuration
我正在學習 RabbitMq 使用 spring 雲 stream Z93F725A07423FE1C889FZ448B3 對 mq 配置有疑問。
根據文件 - spring.cloud.stream.bindings.>channelName>.destination=dest1
我正在使用以下配置並且它正在工作-
spring.cloud.stream.bindings.input.destination=dest1
但是,如果我提到我的頻道名稱來代替下面的輸入,它就不起作用 - spring.cloud.stream.bindings.myChannel.destination=dest1
在我的 class - @INPUT('myChannel')
我的疑問是為什么當我提到 class 和
但是當我提供默認 as.input 時它正在工作。 ..?
更新
MyInterface.java
String CHANNEL = myChannel;
@INPUT(CHANNEL )
SubscribableChannel subs();
MyListener.java
@StreamListener(MyInterface.CHANNEL)
public void queueMsg(String str) {
System.out.println("Str msg = "+str);
}
應用程序.prop
#Below property working fine
spring.cloud.stream.bindings.input.destination=dest1
spring.cloud.stream.bindings.input.binder=rabbit
#Below property NOT working
#spring.cloud.stream.bindings.myChannel.destination=dest1
#spring.cloud.stream.bindings.myChannel.binder=rabbit
在這種情況下,通道名稱是綁定名稱input
。
spring.cloud.stream.bindings。 輸入.destination=dest1
對於 RabbitMQ,目標是我們將發布到的交換名稱。
使用@Input("input")
。
或者
spring.cloud.stream.bindings。 我的頻道.destination =dest1
如果它不起作用,您需要顯示您的偵聽器和界面。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.