We have a Spring Boot Microservice that as well as having HTTP endpoints uses Spring Cloud Bus to pick up refresh events (from rabbit) and also has a Spring Cloud Stream Sink that picks up custom messages from another rabbit topic.
After updating to Spring Boot 2.4.1 and Spring Cloud 2020.0.0 everything seemed to be working until we discovered Spring Cloud Bus was no longer picking up events. Looking into this it turned out some of the Spring Cloud Bus internal channels where not getting created.
This wasn't happening in another service that didn't have the stream functionality as well so we tested disabling that and the bus functionality then started working. So it was obviously some sort of interference between the old style stream model and the newer Spring Cloud Bus.
After updating the our sink to use the new function model I still had issues and eventually got both to work by including the following lines in our application.yml:
spring:
cloud:
stream:
bindings.mySink-in-0.destination: mytopic
function.definition: busConsumer;mySink
So I have the following questions
- Did I miss something or should there be better documentation on how stream / bus can affect each other and the migration to 2020.0.0?
- Does my current configuration look correct?
- It doesn't seem right to have to include busConsumer here - should the auto configuration for it not be able to 'combine it in' with any other stream config?
- What's the difference between
spring.cloud.stream.function.definition
andspring.cloud.function.definition
? I've seen both in documentation and Spring Cloud Bus seems to be also settingspring.cloud.function.definition=busConsumer
spring.cloud.stream.function.definition
is only there for backward compatibility. It is the same asspring.cloud..function.definition
. Also, this appears to be more of a cloud-bus question so hopefully someone will follow up – Oleg Zhurakousky