首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring集成- int-http:inbound-gateway

Spring集成- int-http:inbound-gateway
EN

Stack Overflow用户
提问于 2015-04-28 12:37:07
回答 2查看 1K关注 0票数 0

我已经定义了一个int-http:inbound-gateway,它有一个请求通道和一个应答通道。请求通道连接到服务激活器,该服务激活器验证消息并通过其输出通道返回消息响应。如何将经过验证的消息转发到另一个端点以进行进一步的消息处理?这就像我需要两个输出通道,一个用于响应,一个用于消息。

代码语言:javascript
复制
<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 -->  
EN

回答 2

Stack Overflow用户

发布于 2015-04-28 15:51:34

将应答通道更改为<publish-subscribe-channel/>。这样,回复将返回到网关,您可以订阅另一个组件。您可能需要向通道添加一个任务执行器,以便下游流不会在web容器线程上运行。

票数 1
EN

Stack Overflow用户

发布于 2015-04-29 03:04:15

在转换器中添加一个标志,如果消息有效则返回MessageBuilder.withPayload(Dto).setHeader("ValidFlag",Dto.getValidFlag().toString() .build();添加一个路由器以确定消息是否有效定义传入和传出通道

代码语言:javascript
复制
`<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"/>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29910430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档