Spring Cloud Stream多种功能定义 [英] Spring Cloud Stream multiple function definitions
问题描述
是否可以使用具有多个单独功能/绑定的功能(spring.cloud.function
)风格的反应式SCS应用程序?我发现的所有示例始终仅使用默认绑定input, output
注册一个功能Bean.我想注册多个,每个都有自己的绑定.
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.
传统上,可以使用spring-cloud-stream-reactive
完成此操作,但现在不建议使用它,而提供功能支持.
Traditionally this could be done using spring-cloud-stream-reactive
but it is now deprecated in favor of functional support.
推荐答案
是的,有可能出现在最新快照中,我们将很快制作RC1(忙于会议).这是链接到相关文档.
基本上,您可以根据需要定义任意数量的函数bean,并通过spring.cloud.function.definition
属性用;
分隔函数定义来声明要绑定的函数数量.例如,您要绑定两个功能的--spring.cloud.function.definition=foo;bar|baz
;一个是foo
,第二个是bar|baz
(两个功能的组合).
绑定名称将基于命名约定.例如,foo-in-0
和foo-out-0
.
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
.
这篇关于Spring Cloud Stream多种功能定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!