I would like to get the message from JMS and send it as HTTP request and in case of failure, enqueue it again to JMS.
I've tried using inbound-message-adapter and message-driven-channel-adapter, but it fails as I get "ChannelResolutionException: no output-channel or replyChannel header available" exception but since I do not want to reply to inbound-message-adapter, not sure why would I include a 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>
I expect a success in a normal run, getting error
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.
Also, would like to enqueue the message again to the jms queue if the http:outbound-gateway respond as null or if the 3rd party services are down.
<int:transformer input-channel="clean_no_print_char_update_customershippingaddress"
output-channel="">
You can't have an empty output channel on a transformer.
It doesn't really make sense to transform something and then just discard the transformed result but if that's what you really want to do, send it to the nullChannel
<int:transformer input-channel="clean_no_print_char_update_customershippingaddress"
output-channel="nullChannel">