0

My Cleint is having 2 instances and I am using below snippet to rename the queue and can see testExchange.testQueue is created under which i can see 2 consumers i.e. my client instances but while /bus/refresh I can see only single instance is getting refreshed and I am not getting Cloud Bus feature viz on /bus/refresh all instances should get refreshed, please let me know if I am missing any configuration to rename the queue in readable format.

spring:
 cloud:
   stream:
     bindings:
       springCloudBusInput:
         destination: testExchange
         group: testQueue
   config:
     bus:
       enabled: true
     uri: https://Config-Server-offshore.com/
     name: ClientApp

1 Answers1

0

With spring-cloud-stream, using group creates competing consumers on the same queue.

If you remove the group each instance will get its own queue.

You can use a place holder in the group to make it unique...

spring.cloud.stream.bindings.input.group=${instanceIndex}
instanceIndex=1

...if you are running on cloud foundry, you can use the vcap instance index.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Including group will it give the feature of cloud Bus? Anyway we are hardcoding the group viz is queue name, so again all instances will come under same queue which again creates competing consumers on the same queue. Correct me if I am wrong or how can we create different queue based on instances? I have not used instanceIndex before how to use it? – Vivek Baranwal Nov 22 '17 at 06:29
  • As I said, you can use a property place holder `${foo}` and set the `foo` property to a different value on each instance - perhaps via a property file on the class path. – Gary Russell Nov 22 '17 at 13:55