spring-cloud / spring-cloud-stream

Framework for building Event-Driven Microservices
http://cloud.spring.io/spring-cloud-stream
Apache License 2.0
993 stars 606 forks source link

Clarification about using "-out-" in the binding names when Streambridge is used for Producer instead of Supplier. #3002

Closed Saumrit closed 2 weeks ago

Saumrit commented 2 weeks ago

I am migrating my project from older legacy to latest Spring-boot and SCSt versions. My doubt is do I need to use -out-0 in the binding names while mentioning binding properties under Spring.cloud.stream.bindings.* [for eg: spring.cloud.stream.bindings..destination ] when i am using Streambridge instead of Suppliers for producer. Also what is the real use of spring.cloud.stream.output-binding property?

olegz commented 2 weeks ago

The out-0 or in-0 are the suffixes that are used as part of automatically identify input and output names of the function binding. So if function is called uppercase, then it's input and output bindings are going to be uppercase-in-0 and uppercase-out-0. That is significantly simplified the concept of the binding which in previous versions had to be defined via annotations. Moree details and justifications are available here. With StreamBridge, you can be more flexible since the actual binding is not backed by a function, so you can simply send to foo and if foo destination/binding exists it will be used and if not it will. be auto-provisioned. The spring.cloud.stream.output-binding is designed only for those cases where a binding that is not backed by a function needs to be configured with additional configurations. So by declaring it you are effectively creating a binding and configuring it without actual function backing it. More details are here as well.

olegz commented 2 weeks ago

Also, in the future please use spring-cloiud-stream Stack Overflow for questions

Saumrit commented 2 weeks ago

Much thankx @olegz for the above clarification . I would like to suggest that if the above clarifications can be added with the existing example in the doc , that will be better .

Saumrit commented 2 weeks ago

Thank you!!