Java 过滤消息的HTTP响应
我对Spring和Spring的集成还不熟悉,我决定双腿跳进去——现在,我被卡住了 考虑以下Spring配置—一个向AMQP代理发送请求以进行处理的入站网关:Java 过滤消息的HTTP响应,java,spring,spring-integration,Java,Spring,Spring Integration,我对Spring和Spring的集成还不熟悉,我决定双腿跳进去——现在,我被卡住了 考虑以下Spring配置—一个向AMQP代理发送请求以进行处理的入站网关: <int:channel id="requestChannel" /> <int:channel id="responseChannel"/> <int:channel id="myDiscardChannel"/> <int-http:inbound-gateway id="myInboundG
<int:channel id="requestChannel" />
<int:channel id="responseChannel"/>
<int:channel id="myDiscardChannel"/>
<int-http:inbound-gateway id="myInboundGateway"
request-channel="requestChannel"
reply-channel="responseChannel"
mapped-request-headers="*"
mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS"
path="/foo"
reply-timeout="50000"/>
<int:chain input-channel="requestChannel" output-channel="responseChannel">
<int:filter expression="someExpression" discard-channel="myDiscardChannel" />
<int-amqp:outbound-gateway amqp-template="amqpTemplate" exchange-name-expression="fooexchange" reply-timeout="50000" />
</int:chain>
我希望能够做到的是,当人为的“someExpression”表达式为表示HTTP请求的消息计算false时,使用适当的HTTP状态代码和负载完成原始请求
我已经研究了几种方法:
1) 设置过滤器以生成异常,并在错误通道上处理它们,但我似乎无法正确地做到这一点——很难找到这种技术的适当示例
2) 将筛选器设置为将丢弃的消息发送到丢弃通道-我还不知道如何生成消息并将其发送回将完成原始请求的入站网关
任何帮助都将不胜感激 只需向丢弃通道订阅一个转换器;省略转换器上的输出通道,转换后的结果将返回入站网关 您可以从入站网关和链(输出通道)中删除
应答通道(应答通道);在这种情况下不需要它。谢谢Gary-它确实“那么简单!”。