首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >入站通道适配器抛出“无输出通道或replyChannel标头可用”错误

入站通道适配器抛出“无输出通道或replyChannel标头可用”错误
EN

Stack Overflow用户
提问于 2019-07-22 22:59:32
回答 1查看 339关注 0票数 1

我希望从JMS获取消息并将其作为HTTP请求发送,如果失败,则将其重新排队到JMS。

我尝试过使用入站消息适配器和消息驱动通道适配器,但是失败了,因为我得到了"ChannelResolutionException: no output-channel or replyChannel header available“异常,但是因为我不想回复入站消息适配器,所以不确定为什么要包含replyChannel头

代码语言:javascript
运行
复制
    <jms:outbound-channel-adapter id="outboundJMSAdaptor" jms-template="jmsTemplate"
            channel="jmsOutChannel"
            destination="requestQueue"/>
    <int:channel id="jmsInChannel" />

    <jms:message-driven-channel-adapter
            channel="jmsInChannel" destination="requestQueue"
            connection-factory="jmsConnectionFactory" message-converter="jmsMessageConverter"/>

    <int:header-enricher input-channel="jmsInChannel" output-channel="header_enriched_request">
        <int:header name="addressId" expression="payload.getId()"/>
        <int:header name="Accept-Language" value="en_GB"/>
        <int:header name="X-Source-CountryCode" value="GB"/>
        <int:header name="X-Source-Operator" value="Enterprise"/>
        <int:header name="X-Source-Division" value="CustomerManagement"/>
        <int:header name="X-Source-System" value="${sapwebservices.http.header.source.system}"/>
        <int:header name="X-Source-Timestamp" expression="new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss').format(new java.util.Date())"/>
        <int:header name="Accept" value="application/json"/>
        <int:header name="Content-Type" value="application/json;charset=UTF-8"/>
    </int:header-enricher>

    <int:object-to-json-transformer input-channel="header_enriched_request"
            output-channel="update_customer_shipping_address_outbound_gateway"
            object-mapper="nonNullObjectMapper"/>

    <http:outbound-gateway mapped-request-headers="Accept*, Content-Type, X-*, HTTP_REQUEST_HEADERS"
            request-channel="update_customer_shipping_address_outbound_gateway"
            reply-channel="print_payload_update_shipping"
            url="${sapwebservices.ws.uri.updatecustomershippingaddress}"
            http-method="PUT"
            expected-response-type="java.lang.String"
            charset="UTF-8"
            request-factory="updateCustomerAccountRequestFactory">
        <http:uri-variable name="id" expression="headers['addressId']"/>
    </http:outbound-gateway>
    <int:service-activator input-channel="print_payload_update_shipping" output-channel="clean_no_print_char_update_customershippingaddress" ref="sapPrintPayload"/>
    <int:transformer input-channel="clean_no_print_char_update_customershippingaddress" output-channel="resp_mapping_json_to_jsonobj_updatecustomershippingaddress">
        <bean class="util.CleanNoPrintCharTransformer"/>
    </int:transformer>
    <int:json-to-object-transformer input-channel="resp_mapping_json_to_jsonobj_updatecustomershippingaddress"
                                    output-channel="clean_no_print_char_update_customershippingaddress"
                                    type="customer_shipping_address_response.json.CustomerShippingAddressResponse"/>
    <int:transformer input-channel="clean_no_print_char_update_customershippingaddress" output-channel="">
        <bean class="transformer.CreateCustomerShippingAddressPostTransformer"/>
    </int:transformer>

我期望在正常运行中获得成功,但得到错误

代码语言:javascript
运行
复制
org.springframework.integration.dispatcher.AggregateMessageDeliveryException: All attempts to deliver Message to MessageHandlers failed. Multiple causes:
    All attempts to deliver Message to MessageHandlers failed. Multiple causes:
    no output-channel or replyChannel header available
    org.springframework.integration.MessageHandlingException: org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): Method call: Method transform(rest.bbr.customer_shipping_address_response.json.CustomerShippingAddressResponse) cannot be found on bbr.sap.util.CleanNoPrintCharTransformer type
See below for the stacktrace of the first cause.
    org.springframework.integration.MessageHandlingException: org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): Method call: Method transform(java.lang.String) cannot be found on bbr.sap.transformer.CreateCustomerShippingAddressPostTransformer type
See below for the stacktrace of the first cause.

此外,如果http:outbound-gateway响应为null或如果第三方服务关闭,则希望将消息再次入队到jms队列。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-22 23:24:22

代码语言:javascript
运行
复制
<int:transformer input-channel="clean_no_print_char_update_customershippingaddress" 
        output-channel="">

transformer上不能有空的输出通道。

转换一些东西,然后丢弃转换后的结果是没有意义的,但是如果这是您真正想要做的,那么将它发送到nullChannel

代码语言:javascript
运行
复制
<int:transformer input-channel="clean_no_print_char_update_customershippingaddress" 
        output-channel="nullChannel">
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57148742

复制
相关文章

相似问题

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