I am learning RabbitMq using spring cloud stream java. Having doubts in the mq configuration.
As per documents - spring.cloud.stream.bindings.>channelName>.destination=dest1
I am using below configuration and it's working-
spring.cloud.stream.bindings.input.destination=dest1
But if I mention my channel name in place of input like below, it's not working - spring.cloud.stream.bindings.myChannel.destination=dest1
In my class - @INPUT('myChannel')
My doubt is why is it not working when I mention the channelName given in class and
But it is working when I give default as.input. ..?
UPDATE
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);
}
application.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
The channel name is the binding name input
in this case.
spring.cloud.stream.bindings. input .destination=dest1
For RabbitMQ, the destination is the exchange name that we will publish to.
Use @Input("input")
.
Or
spring.cloud.stream.bindings. myChannel .destination=dest1
If it's not working, you need to show your listener and interface.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.