Powered By Blogger

Tuesday, June 25, 2013

Oracle JMS Sync/Async Request-Reply Pattern

 We can use the Oracle SOA 11g JMS Adapter to implement following interaction patterns
  • synchronous request reply interaction pattern
  • asynchronous request reply interaction pattern 

Synchronous request reply interaction pattern

This pattern allows the Oracle JMS Adapter sends a request to the request JMS queue and waits for a response from the reply JMS queue before further execution continues.
In turn, the adapter will set the JMSReplyTo header to the reply destination. This value is then used by a message consumer  to send the message to the reply destination which is then dequeued by the Oracle JMS Adapter and continue further processing.
Behind the scenes, the Oracle JMS Adapter uses a new interaction pattern called JmsRequestReplyInteractionSpec.
In above case JMS adapter framework automatically sets JMSReplyTo header on request message  to jms/ExceptionRespQueue and waits for the message on jms/ExceptionRespQueue. It is message consumer responsibility to read JMSReplyTo header and send message to the destination mentioned in the header

JMS adapter wizard showing Request/Reply operation modelling


Above wizard generates below JCA file

<adapter-config name="SyncRequest-Reply" adapter="JMS Adapter" wsdlLocation="SyncRequest_Reply.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
<connection-factory location="eis/wls/Queue" UIJmsProvider="WLSJMS" UiOperationMode="Synchronous" UIConnectionName="Dev2"/>
<endpoint-interaction portType="Request_Reply_ptt" operation="Request_Reply" UITransmissionPrimitive="Request-response">

<interaction-spec className="oracle.tip.adapter.jms.outbound.JmsRequestReplyInteractionSpec">
<property name="TimeToLive" value="0"/>
<property name="PayloadType" value="TextMessage"/>
<property name="DeliveryMode" value="Persistent"/>
<property name="ReplyDestinationName" value="jms/b2b/B2B_IN_QUEUE"/>
<property name="RequestDestinationName" value="jms/b2b/B2B_OUT_QUEUE"/>
</interaction-spec>
</endpoint-interaction>
</adapter-config>

Oracle recommendations for this pattern

  • Oracle suggests when using the Oracle JMS Adapter in a synchronous pattern ensure that you use a non-XA connection factory and set the connector factory isTransacted property to true in weblogic-ra.xml.
  • The connection factory must be weblogic.jms.ConnectionFactory or any other non-XA connection factory.
If we get into BPEL design we will be having invoke activity pointing to JMS adapter reference invoking Request_Reply operation and invoke activity is blocked from further execution untill it receives response from response queue

 Asynchronous request reply interaction pattern


We can use the Adapter configuration wizard to model a process that allows Oracle JMS Adapter to be used in an asynchronous request reply interaction pattern.

This pattern allows an Oracle JMS Adapter to send a message to a JMS destination.
When sending message it sets JMSReplyTo header on request message  to Reply destination JNDI name
Consumer reads the header on message and replies to that destination.
When a message is received on the reply queue, the Oracle JMS Adapter is able to route message to the correct composite or the component instance. The correlation is done based on the JMSMessageID of the request message, which becomes the JMSCorrelationID of the reply message, and the conversation ID of the underlying component.

JMS adapter wizard showing Async Request/Reply operation modelling






Above wizard generates below JCA file.Note that there are two interaction specs generated. One for producing and another for consuming message

<adapter-config name="Async-Request-Reply" adapter="JMS Adapter" wsdlLocation="Async_Request_Reply.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">

<connection-factory location="eis/wls/Queue" UIJmsProvider="WLSJMS" UiOperationMode="Asynchronous" UIConnectionName="Dev2"/>

<endpoint-activation portType="Reply_ptt" operation="Reply" UITransmissionPrimitive="Request-response">
<activation-spec className="oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec">
<property name="PayloadType" value="TextMessage"/>
<property name="UseMessageListener" value="false"/>
<property name="DestinationName" value="jms/b2b/B2B_OUT_QUEUE"/>
</activation-spec>
</endpoint-activation>

<endpoint-interaction portType="Request_ptt" operation="Request" UITransmissionPrimitive="Request-response">
<interaction-spec className="oracle.tip.adapter.jms.outbound.JmsProduceInteractionSpec">
<property name="TimeToLive" value="0"/>
<property name="PayloadType" value="TextMessage"/>
<property name="DeliveryMode" value="Persistent"/>
<property name="DestinationName" value="jms/b2b/B2B_IN_QUEUE"/>
</interaction-spec>
</endpoint-interaction>
</adapter-config>

If we get into BPEL design  we will be having invoke activity pointing to JMS adapter reference invoking Request operation and we need to use receive activity pointing to same JMS adapter reference but waiting on Receive operation

1 comment:

  1. Hi This is helpful post. It would be really helpful if you have any sample project for Oracle SOA JMS adapter configuration with Message ID Oracle SOA 12c online training

    ReplyDelete