入站通道适配器抛出 "no output-channel or replyChannel header available" 错误

Inbound channel adapter throwing "no output-channel or replyChannel header available" error

我想从 JMS 获取消息并将其作为 HTTP 请求发送,如果失败,再queue将其发送到 JMS。

我试过使用 inbound-message-adapter 和 message-driven-channel-adapter,但它失败了,因为我收到 "ChannelResolutionException: no output-channel or replyChannel header available" 异常,但因为我不想回复 inbound-message-adapter,所以不确定为什么我要包括 replyChannel header


    <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>

我希望在正常情况下成功 运行,出现错误

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-网关响应为空或第 3 方服务已关闭,我想再次向 jms queue 发送 queue 消息。

<int:transformer input-channel="clean_no_print_char_update_customershippingaddress" 
        output-channel="">

变压器上不能有空输出通道。

转换某些东西然后丢弃转换后的结果并没有什么意义,但如果那是你真正想做的,请将它发送到 nullChannel

<int:transformer input-channel="clean_no_print_char_update_customershippingaddress" 
        output-channel="nullChannel">