spring cloud stream - 微服务能否同时作为源和汇

spring cloud stream - Can a MicroService a source and a sink at the same time

我有一个简单的问题 - 微服务(Spring 引导应用程序)是否可能同时是源和接收器 - 那么在微服务中是否有可能 class 被注释为

@InboundChannelAdapter 

微服务的另一个 class 注释为

@StreamListener

是的,这是可能的。您只需要为它们正确配置绑定即可。

您甚至可以使用不同的活页夹:https://docs.spring.io/spring-cloud-stream/docs/Chelsea.SR2/reference/htmlsingle/index.html#multiple-systems!

将微服务的 sourcesink 功能视为应用程序的 端口 。所以,你可能有几个,每个都可以执行独立的逻辑。

唯一的问题是您无法在 Spring 云数据流中使用此自定义 Spring 云流应用程序。有必要遵循特定的命名和结构约定。