首先就是現有的SI Java和註解配置的擴展,因此它可以與任何其他Java配置使用。 XML @Import
當然也是可能的。
有一個在DSL沒有網關的配置,因爲它的方法不能與線性IntegrationFlow
是有線的。需要爲每種方法提供下游流。
所以,@MessagingGateway
是繼續一個正確的方法:
@MessagingGateway(name = "notificationExecutionsListener", defaultRequestChannel = "stepExecutionsChannel")
public interface MyStepExecutionListener extends StepExecutionListener {}
來自對岸@MessagingGateway
解析以及<gateway>
標籤解析與GatewayProxyFactoryBean
定義結束。所以,你只可以聲明豆,如果你不希望引入一個新的類:
@Bean
public GatewayProxyFactoryBean notificationExecutionsListener(MessageChannel stepExecutionsChannel) {
GatewayProxyFactoryBean gateway = new GatewayProxyFactoryBean(StepExecutionListener.class);
gateway.setDefaultRequestChannel(stepExecutionsChannel);
return gateway;
}
最新Milestone 3我有一個想法,介紹nested flows
,我們可能能夠引進了Gateway
支持後流動。事情是這樣的:
@Bean
public IntegrationFlow gatewayFlow() {
return IntegrationFlows
.from(MyGateway.class, g ->
g.method("save", f -> f.transform(...)
.filter(...))
.method("delete", f -> f.handle(...)))
.handle(...)
.get();
}
但是我不知道,這將簡化生活,至於任何嵌套拉姆達只是增加了更多的噪音,並可能打破loosely coupling
原則。
嗨Artem,謝謝你的詳細解答。是否可以在GatewayEndpointSpec中添加一種指定服務接口的方法,以便最近添加的.gateway()EIP方法可用於設置網關和相應的服務接口? – Menno 2014-09-11 12:48:24
不,因爲'.gateway()'在''內扮演與''相同的角色,並且它是流程的中間部分。當'@ MessagingGateway'是使用方法調用和DI從代碼到Spring Integration Flow的POJI橋。不要混淆顧慮。無論如何,你需要一個來自批量步驟偵聽器的「方法調用」。因此對'.gateway()'所做的任何修改都不會對您有所幫助,因爲您的批處理作業恰好啓動了接口上的流程調用方法。 –
2014-09-11 12:56:15
是的,我明白你的觀點。謝謝你清理那個。 – Menno 2014-09-11 16:59:33