我正在试图找到一种方法,从当前可用的spring集成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>打个比方,如果弹簧集成,EIP组件就像基本的电子元件(晶体管、电容器、电阻器、二极管等)。我想创造集成电路的等价物(加法器、放大器等)。
这样,随着时间的推移,越来越复杂的系统可以很容易地创建出来。这样的系统将更容易测试和维护。那么,这样的事情是可能的吗?如果是这样,又是如何做到的呢?如果不是,人们会认为这是一件好事吗?
发布于 2015-12-24 04:27:57
您的意思并不完全清楚;您的第二个代码片段就像您的第一个代码片段中的链一样,只是出站适配器上多了几个属性。
请参阅spring-integration-flow,它是一个扩展,它提供了一种机制来配置子流,这些子流可以作为“服务”从其他流中调用。
https://stackoverflow.com/questions/34441669
复制相似问题