Pages

Wednesday, December 1, 2010

Spring - TIBCO - JMS Integration - Asynchronous Approach

In Synchronous approach we used <jms:outboundGateway> in Asynchornous approach we will use <jms:outbound-channel-adapter> and <jms:message-driven-channel-adapter>:

Here is your messaging xml configuration should look like:

    <channel id="outboundMessageChannel">    </channel>
    <channel id="inboundMessageChannel">    </channel>
    <channel id="preMarshalledMessageChannel"/>
    <channel id="unMarshalledMessageChannel"/>


    <jms:outbound-channel-adapter id="jmsMessageOut"
                                  channel="outboundMessageChannel"
                                  jms-template="jmsTemplate"/>


    <si-xml:marshalling-transformer id="marshallerWithPoller"
                                    input-channel="preMarshalledMessageChannel"
                                    output-channel="outboundMessageChannel"
                                    marshaller="jaxbMarshaller"
                                    result-transformer="resultToStringTransformer"/>


    <si-xml:unmarshalling-transformer id="defaultUnmarshaller"
                                      input-channel="inboundMessageChannel"
                                      output-channel="unMarshalledMessageChannel"
                                      unmarshaller="jaxbMarshaller"/>


    <jms:message-driven-channel-adapter id="jmsMessageIn"
                                        channel="inboundMessageChannel"
                                        destination="messageToStoreReplyQueue"
                                        connection-factory="connectionFactory"
            />


    <service-activator id="testMessageEndPoint" input-channel="unMarshalledMessageChannel"
                       method="handleMessageResponse" auto-startup="true">

    <beans:bean class="com.test.ResponseService"/>
    </service-activator>


To listen your responses you should create the service-activator class which is "ResponseService" and when ever there is a message in "unMarshalledMessageChannel" your service activators method "handleMessageResponse" will be invoked with appropriate unmarshalled message.

For total configuration refer to my other post - http://myjavatechnologies.blogspot.com/2010/11/spring-integration.html

Happy Integration!

No comments:

Post a Comment