Search code examples
spring-cloud-streamreactivespring-cloud-function

Spring Cloud Stream multiple function definitions


Is it possible to have reactive SCS application using functional (spring.cloud.function) style with multiple, separate functions / bindings? All examples I have found always register only one functional bean with default bindings input, output. I would like to register multiple, each with its own bindings.

Traditionally this could be done using spring-cloud-stream-reactive but it is now deprecated in favor of functional support.


Solution

  • Yes, it is possible in the latest snapshot and we'll be making RC1 shortly (were busy with the conference). Here is the link to the relevant docs. Basically you define as many function beans as you want and you declare how many functions you want to bind via spring.cloud.function.definition property delimiting function definitions with ;. For example, --spring.cloud.function.definition=foo;bar|baz where you are binding two functions; one is foo and second is bar|baz (composition of two functions). The binding names will be based on the naming convention. For example, foo-in-0 and foo-out-0.