2015-12-23 73 views
1

我想找到一種方法來從當前可用的彈簧集成EIP組件中創建更高級別的抽象組件。例如,我想換成了幾個結構: 使用彈簧集成製作更高級別的抽象組件

<int:gateway id="inMemoryPopulator" 
      default-request-channel="channel" 
      service-interface="com.xyz.gateway.InMemoryPopulator"/> 

<!-- dispatching to JMS --> 

<int:gateway id="jmsPopulator" 
      default-request-channel="dispatchChannel" 
      service-interface="com.xyz.gateway.JMSPopulator"/> 

<int:channel id="dispatchChannel"/> 

<int:chain input-channel="dispatchChannel"> 
<int:header-enricher ref="queueNameEnricher" 
        method="populateQueueName"/> 
<int-jms:outbound-channel-adapter id="jmsOut" 
            destination-expression="headers.targetQueueName"/> 
</int:chain> 

的東西,如:

<int:chain input-channel="channel"> 
    <int:header-enricher ref="queueNameEnricher" 
         method="populateQueueName"/> 
    <int-jms:outbound-channel-adapter-fast id="fastJmsOut" 
              number-workers="10"      
              internal-queue-size="1000" 
              destination-expression="headers.targetQueueName"/> 
</int:chain> 

要使用一個比喻,如果Spring集成EIP組件,如基本的電子元件(晶體管,電容器,電阻器,二極管等)我想創建相當於集成電路(加法器,放大器等)。

這樣,隨着時間的推移,可以輕鬆創建日益複雜的系統。這樣的系統將更容易測試和維護。那麼這是可能的嗎?如果是的話如何?如果沒有,人們是否認爲這將是一件好事情可用?

回答

0

這並不完全清楚你的意思;你的第二個片段就像你的第一個片段中的鏈,在出站適配器上只有幾個屬性。

請參閱spring-integration-flow這是一個擴展,它提供了一種機制來配置可從其他流調用爲「服務」的子流。

+0

區別在於第二個代碼片段封裝並「隱藏」了單個構造中的所有內容。注意名稱(出站通道適配器快速)以區別於常規(出站通道適配器)。如果我想構建這樣的構造,我該怎麼做呢?感謝指向春季整合流程的指針。將看看,看看我是否可以使用它。 – xbranko