2016-09-16 38 views
1

我有四個子流,每個子流都坐在自己的應用程序中並打包在jar文件中。
每個子流都構建爲彈簧引導應用程序。
每個子流都有輸入通道和輸出通道。
如何處理打包在單獨jar中的子流

我希望將主流程放在自己的spring-boot應用程序中,該應用程序將依次調用這4個子流程。
彈簧一體化可能嗎?
如果不可能,最好的方法是什麼?
我在網上搜索,看看
How to handle subflows
https://github.com/spring-projects/spring-integration-flow
和其他一切我能找到,但仍然不知道如何着手。
https://github.com/spring-projects/spring-integration-flow指出,使用子流,我需要在我的XML
int-flow:flow id="subflow1"
如何配合這個subflow1到我的子流打包在單獨的罐子。
然後,我將如何在我的主流程中調用這個子流程,這是Spring引導應用程序?
我是否將消息發送到每個子流的輸入通道以啓動子流或執行其他操作? 謝謝,大衛

子流xml文件的示例。
我刪除了文件的不相關部分,以縮短它,把...代替刪除信息

<int:channel id="createTwo"/> 
<int:service-activator input-channel="createOne" output-channel="createTwo"   
    ref="automationUtilities" method="createTwo"/>   
... 

<int:service-activator input-channel="createFive"   
    ref="automationUtilities" method="createSix"/>          

<bean id="automationUtilities" class="package.BeanName" /> 
<bean id="validator" class="package.anotherBeanName" /> 
<util:properties id="config" location="classpath:application.properties"/> 

回答

0

如果你所有的應用程序都是春天引導,那麼他們是微服務和各他們居住在其JVM上。因此只有inputoutput渠道是不夠的。因爲你不能只從一個JVM發送消息到另一個。

由於它們都是Spring Boot,因此可以考慮爲它們添加一些REST功能。至少簡單的<int-http:inbound-gateway>接收來自外部世界的消息。和<int-http:outbound-gateway>執行從一個應用程序到另一個應用程序的REST請求。

OTOH考慮使用Spring Cloud Stream項目,該項目正是爲消息傳遞微服務通信而建立的。它基於Binder概念,目前是Kafka或RabbitMQ。