我有一个服务需要建模为流应用程序(该服务目前为相同的用例提供同步和异步 api )。我正在探索实际处理是否可以建模为流应用程序。由于处理阶段保持相同 - 真正的区别是服务接口(http 与消息传递协议)。
在这种背景下,我正在探索 Spring Cloud Stream,因为它似乎抽象了绑定器和处理器。但为了支持同步 API,我需要以下内容:-
将会有 2 个可部署的东西,这很好,并且处理器可以打包为一个库以供这两个工件使用。现在我在 Spring Cloud Stream 中看不到任何 Http Binder,有什么我可以使用的吗?这个流程看起来还好吗?
是的,有 HTTP 的实现。请检查以下链接:
流应用程序
https://github.com/spring-cloud/stream-applications
可重用功能
java.util.Supplier
https://github.com/spring-cloud/stream-applications/blob/master/functions/supplier/http-supplier/README.adoc
java.util.Function
https://github.com/spring-cloud/stream-applications/blob/master/functions/function/http-request-function/README.adoc
可重用的 Spring Cloud Stream 应用程序
来源
https://github.com/spring-cloud/stream-applications/blob/master/applications/source/http-source/README.adoc
处理器
https://github.com/spring-cloud/stream-applications/blob/master/applications/processor/http-request-processor/README.adoc