spring-integration - requestMessage 中的负载正在使用出站网关请求中的响应对象进行修改

标签 spring-integration

<channel id="shipTypeInfo" />

<int-http:outbound-gateway id="shipInfoGateway"
    request-channel="shipTypeInfo"
    url="${oms.config.service.provider}omsconfig/shiptype?shipTypeId={shipTypeId}"
    http-method="GET" reply-channel="shipTypeInfo"
    extract-request-payload="false" 
    expected-response-type="com.abc.xyz.mac.integration.audit.domain.someInfo">
    <int-http:uri-variable name="shipTypeId"
        expression="payload" />
</int-http:outbound-gateway>`

在我的服务中使用“整数”输入调用 shipTypeGateway 时,整数值进入负载并正确调用外部服务,但我收到 HTTP: 415 错误。

当我调试时,我观察到:HttpRequestExecutingMessageHandler.handleRequestMessage(Message requestMessage) 调用了 2 次。

第一次,有效负载按预期使用整数并再次在内部调用第二次,但是第二次时间有效负载被响应对象(ShipInfo)修改,这就是为什么它给出响应 HTTP: 415 error

如何使第二次有效负载也应该与整数一起使用。

如有任何帮助,我们将不胜感激。

注意:当前使用的是 Spring-Integration 4.1.6。

最佳答案

嗯,有request-channel="shipTypeInfo" reply-channel="shipTypeInfo"作为一个循环,在我们为第二个调用成功之后,你打算为第三个调用做什么?

所以,你必须重新设计你的逻辑并引入一些router/filter之后<int-http:outbound-gateway>确定您是否需要第二次通话或已经不需要。此外,在下游您将能够transform你的ShipInfo为第二次调用返回整数。

无论如何,我无法用当前的解决方案帮助您解决原始问题。它只是没有意义。

关于spring-integration - requestMessage 中的负载正在使用出站网关请求中的响应对象进行修改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34426586/

相关文章:

spring-integration - Spring 集成 Java DSL : creating jms Message Driver Channel Adapter

spring-data - 在 Spring 中使用 Greenplum

java - spring 集成流程中的错误处理实践

spring-integration - 使用 UnZipResultSplitter 时丢失 header

java - Spring 集成和响应式(Reactive) WebSockets

spring-integration - 我如何在 spring-integration-aws 中使用 sqs-message-driven-channel-adapter

java - 如何在单独的 Spring 集成应用程序中实现 JMS 入站和出站配置?

java - 使用 Spring 进行 http url 轮询的最佳方法是什么?

java - FtpStreamingMessageSource - 失败时重试

java - Spring Integration - DSL - 拆分或 fork