Spring integration Spring integration DSL::从xml调用通道时面临问题

Spring integration Spring integration DSL::从xml调用通道时面临问题,spring-integration,spring-integration-dsl,Spring Integration,Spring Integration Dsl,我做了一个简单的DSL,它从数据库检索数据,并在ServiceActivator中进行简单的转换 @Bean public IntegrationFlow mainFlow() { return IntegrationFlows.from("userChannel") .channel("queryChannel") .handle("sampleConvertor","convertUser")

我做了一个简单的DSL,它从数据库检索数据,并在ServiceActivator中进行简单的转换

    @Bean
public IntegrationFlow mainFlow() {
    return IntegrationFlows.from("userChannel")
                .channel("queryChannel")
                .handle("sampleConvertor","convertUser")
                .get();
queryChannel是jdbc出站网关,sampleConverter是服务激活器

<int-jdbc:outbound-gateway query="select * from employee where employee_id=:payload"
request-channel="queryChannel" data-source="dataSource"/>

问题是在从数据库检索数据之后,流不会进入serviceActivator,它只是返回数据库响应

在xml配置中,我曾经调用链内的网关,如下所示

<int:gateway id="query.gateway" request-channel="queryChannel"/>


请说明我做错了什么。提前感谢。

结合Java DSL和XML配置有点不寻常,但它们仍然可以一起工作

您的问题我认为您忽略了这样一个事实:您的
queryChannel
在运行时有两个订户,而不是一个调用链

第一个是
,第二个是
.handle(“sampleConvertor”、“convertUser”)
。对,当您在
IntegrationFlow
中声明一个频道时,下一个EIP方法将为该频道生成一个订户。同时,当您在XML配置中使用类似于
request channel
input channel
的频道时,也会带来订阅者

因此,
DirectChannel
上有两个订阅者使用
RoundRobinLoadBalancingStrategy
,因此只有一个订阅者将处理消息,如果消息是请求-应答组件,与此类似,
它将向
输出频道
或标题中的
回复频道
生成消息。在你的例子中,这个故事正是关于一个
回复频道的
,因此你不去
句柄(“sampleConvertor”,“convertUser”)
,因为它不是链条中的下一个,而是循环算法中的一个平行宇宙


如果你真的想达到<代码>句柄(“SAMPLEECOVER”,“CurrtUnter”)<代码> >在调用<代码> <代码>之后,你应该考虑使用<代码> .Gateway(“QuehansChanway”)< /C> >而不是那个<代码>。Chhanle()/代码> .< /P>替换。非常感谢你。