spring-cloud / spring-cloud-bus

Spring Cloud event bus
http://cloud.spring.io/spring-cloud-bus/
Apache License 2.0
409 stars 242 forks source link

Refactors bus to use spring cloud function. #236

Closed spencergibb closed 4 years ago

spencergibb commented 4 years ago

Rather than the annotation model.

fixes gh-227

sliard commented 4 years ago

Hi,

I also had conflict between cloud stream and cloud bus. I tested this PR into my project that used spring stream with function, so I already have a properties "spring.cloud.stream.function.definition", and it's work only if I add "busConsumer" manualy to this properties. BusEnvironmentPostProcessor does not seem sufficient.

I add your PR into my sample project if you want to try : https://github.com/sliard/spring-cloud-stream-basic/tree/test-cloud-bus

ghost commented 3 years ago

@sliard, don't think this is an issue as the documentation mention that:

"To specify which functional bean to bind to the external destination(s) exposed by the bindings, you must provide spring.cloud.function.definition property."

and also:

"In the event you only have single bean of type java.util.function.[Supplier/Function/Consumer], you can skip the spring.cloud.function.definition property, since such functional bean will be auto-discovered. However, it is considered best practice to use such property to avoid any confusion."

My interpretation is that you should use this property whenever you have more than one functional beans of the same type (including those from your dependencies). The version I am using is spring-cloud-stream 3.1.2.

See also: Spring Cloud Function Support