Here is the current set up if it helps :
It is based on the collaborative adapter example...Code:<int:gateway id="barxServerGateway" service-interface="MyServerGateway" default-request-channel="toErrorCatchingGw"/> <int:service-activator input-channel="toErrorCatchingGw" ref="errorCatchingGw"/> <int:gateway id="errorCatchingGw" error-channel="errorObject" default-request-channel="requestObject"/> <!-- Channels --> <int:publish-subscribe-channel id="requestTcp"/> <int-ip:tcp-connection-factory id="clientConnectionFactory" type="client" single-use="false" using-nio="true"/> <!-- Outbound adapter - Send requests --> <int-ip:tcp-outbound-channel-adapter channel="requestTcp" connection-factory="clientConnectionFactory" order="2"/> <!-- Inbound adapter - Receive asynchronous replies --> <int-ip:tcp-inbound-channel-adapter channel="responseTcp" connection-factory="clientConnectionFactory"/> <!-- Use bridge to also send all requests to the aggregator where they will stay blocked, waiting for a response --> <int:bridge input-channel="requestTcp" output-channel="toAggregator" order="1"/> <!-- Aggregator matches incoming responses to the blocked requests and releases them --> <int:aggregator input-channel="toAggregator" output-channel="aggregatedResponseObject" expire-groups-upon-completion="true" release-strategy="customCorrelator" correlation-strategy="customCorrelator"/> <!-- Extract the second object - the response --> <int:transformer input-channel="aggregatedResponseObject" expression="payload.get(1)"/> <int:filter input-channel="errorObject" ref="connectionManager" method="filterException" discard-channel="nonResponseException"/> <!-- Handle any not yet handled exceptions --> <int:transformer input-channel="nonResponseException" ref="connectionManager" method="handleException"/>
And here are the request / response processing chains :
Code:<int:chain input-channel="requestObject" output-channel="requestTcp"> <!-- populate some headers, so that we can use them during further transformation --> <int:header-enricher> <int:header name="messageId" ref="requestHeaderEnricher" method="readIncrementedMessageId"/> </int:header-enricher> <!-- Convert request object into XML via JAXB --> <int-xml:marshalling-transformer marshaller="jaxbMarshaller" result-type="StringResult"/> <!-- Convert JAXB DOM into a string --> <int:object-to-string-transformer/> <!-- Transform XML string via XSLT - add a Message envelope --> <int-xml:xslt-transformer xsl-resource="request.xsl" xslt-param-headers="messageId"/> <!-- Add a binary message envelope --> <int:transformer ref="binaryTransformer" method="marshall"/> </int:chain> <int:chain input-channel="responseTcp" output-channel="toAggregator"> <!-- Convert response object from byte array into a String --> <int:transformer expression="new String(payload)"/> <!-- Enrich some headers --> <int-xml:xpath-header-enricher> <int-xml:header name="messageId" evaluation-type="STRING_RESULT" xpath-expression="Message/Header/@msgid"/> </int-xml:xpath-header-enricher> <!-- Transform XML string via XSLT - strip the Message envelope --> <int-xml:xslt-transformer xsl-resource="response.xsl"/> <!-- Convert response XML into objects via JAXB --> <int-xml:unmarshalling-transformer unmarshaller="jaxbMarshaller"/> <!-- Filter out incoming heartbeats/pings --> <int:filter ref="connectionManager" method="filterPing"/> <!-- Transform any errors into exceptions, and mark them as handled --> <int:transformer ref="connectionManager" method="transformPotentialError"/> </int:chain>


Reply With Quote

