spring integration - How to manage payload during interaction with multiple endpoints in a SI flow -
i trying understand options available handling payload within si flow communicates multiple endpoints.
i have web service entry point defined using int-ws:inbound-gateway. receives soap message below payload:
soap request
<soapenv:envelope> <soapenv:header/> <soapenv:body> <emp:employee> <emp:empid>sf</emp:empid> <emp:empname></emp:empname> </emp:employee> </soapenv:body> </soapenv:envelope>
the si flow extracts empid , passes string payload jms queue. jms endpoint replies employee name string type. si flow maps employee name element empname in response message.
soap response
<soapenv:envelope> <soapenv:header/> <soapenv:body> <emp:employee> <emp:empid>sf</emp:empid> <emp:empname>spring framework</emp:empname> </emp:employee> </soapenv:body> </soapenv:envelope>
to implement use case have used claim check pattern. used header store reply jms endpoint.
it great if suggest other approach considering fact si flow communicate other endpoints (each having own data exchange format) in addition jms endpoint. want avoid using header store jms reply payload.
config file
<int-ws:inbound-gateway id="ws-inbound-emp-gateway" request-channel="ws-requests" marshaller="jaxbmarshaller" unmarshaller="jaxbmarshaller" header-mapper="custommapper" /> <int:chain input-channel="ws-requests" output-channel="responsepipe"> <int:claim-check-in message-store="simplemessagestore"/> <int:header-enricher> <int:header name="msgid" expression="payload"/> </int:header-enricher> <int:transformer expression="headers['msgid']"/> <int:claim-check-out message-store="simplemessagestore" remove-message="false"/> <int:transformer expression="payload.getempid()"/> <int-jms:outbound-gateway request-destination="requestqueue" reply-destination="responsequeue" requires-reply="true"/> </int:chain> <int:chain input-channel="responsepipe" > <int:header-enricher> <int:header name="empnameresponse" expression="payload"/> </int:header-enricher> <int:transformer expression="headers['msgid']"/> <int:claim-check-out message-store="simplemessagestore" remove-message="true"/> <int:enricher> <int:property name="empname" expression="headers['empnameresponse']"/> </int:enricher> </int:chain>
for case see content enricher pattern, implement <enricher>
in spring integration.
so, need unmarshal xml request pojo, e.g. using jaxb. configure several <enricher>
, map downstream replies appropriate property of pojo.
in end, after phases, should marshal final pojo xml , send response via soap.
the sample here.
Comments
Post a Comment