我已经定义了一个int-http:inbound-gateway,它有一个请求通道和一个应答通道。请求通道连接到服务激活器,该服务激活器验证消息并通过其输出通道返回消息响应。如何将经过验证的消息转发到另一个端点以进行进一步的消息处理?这就像我需要两个输出通道,一个用于响应,一个用于消息。
<int-http:inbound-gateway
request-channel="requestChannel"
reply-channel="responseChannel"
supported-methods="POST"
path="/message/hl7/{source}">
<int-http:request-mapping
consumes="application/json" produces="application/json"/>
<int-http:header name="source" expression="#pathVariables.source"/>
</int-http:inbound-gateway>
<int:service-activator ref="HL7MessageEndpoint"
method="POST"
input-channel="requestChannel"
output-channel="responseChannel"/>
<!-- need to send original message to jms if service activator validates successfully --> 发布于 2015-04-28 15:51:34
将应答通道更改为<publish-subscribe-channel/>。这样,回复将返回到网关,您可以订阅另一个组件。您可能需要向通道添加一个任务执行器,以便下游流不会在web容器线程上运行。
发布于 2015-04-29 03:04:15
在转换器中添加一个标志,如果消息有效则返回MessageBuilder.withPayload(Dto).setHeader("ValidFlag",Dto.getValidFlag().toString() .build();添加一个路由器以确定消息是否有效定义传入和传出通道
`<channel id="requestInChannel"/>
<channel id="outputActivatorInChannel" />
<channel id="validatorInChannel"/>
<header-value-router input-channel="requestInChannel"
header-name="validFalg" default-output-channel="validatorInChannel"
resolution-required="false">
<mapping value="false" channel="outputActivatorInChannel" />
<mapping value="true" channel="validatorInChannel" />
</header-value-router>`如果消息有效,则将输入通道设置为两个不同的激活器
<int:service-activator ref="OutputActibvator" method="POST" input-channel="validatorInChannel" output-channel="responseChannel"/>
https://stackoverflow.com/questions/29910430
复制相似问题