In Soa Suite 11g the JMS adapter has support for request reply operations. You can use this operation in synchronous or asynchronous mode. In this blog I will show you both modes. I start with a Asynchronous example and at the end I describe the synchronous mode.
Asynchronous Request / Reply
First we start with a simple Asychronous request and reply JMS adapter. Add a JMS adapter to the references site of the composite.
Choose Request/ Reply and off course asynchronous
Select a request queue ( need to create this in the wls console ) and provide the jndi name of jms resource adapter ( define this in the jms resource adapter ) . Very important use a xa transacted jms connection factory in the jms resource adapter and leave the rest as default.
In the Reply we provide the response queue and use the same jms resource adapter jndi name of the request
Provide the request and response element.
With this as result.
Now we can use this jms adapter in a asynchronous Mediator or in a synchronous BPEL process.
First we start with the mediator. Add a Mediator with the same input and output as the jms adapter
Wire the JMS adapter to this Mediator so we can define the routing rules.
With this as result.
Because this asynchronous service is hard to test, so I will also make a synchronous BPEL process which calls this asynchronous jms adapter with a invoke and receive activity.
Add a BPEL process with the same input and output as the jms adapter
Here an overview of the BPEL process with the invoke and receive activity
Picture of my test composite
For testing we need to transfer the jms message from the request queue to the reply queue. So I add a mediator with a consume and produce jms adapter.
Very important, we need to assign the message id of the jms message to the correlation id of the reply jms message. Do this in the assign of the routing rule.
Last thing is to test the BPEL process in the enterprise manager
With this as result.
Synchronous Request / Reply
The synchronous request reply jms adapter works a bit different then asynchronous.
In step 6 we now select synchronous
In step 7 we can provide the request and reply queue. But very important we to provide the jndi name of a jms resource adapter which has transacted on true and use a jms connection factory which is not xa transacted.
With synchronous jms adapter I had to switch the request and response element. Very strange ( is it a bug ).
This synchronous jms message is a bit different, this message has the JCA_JMSReplyTo field which contains the reply queue name.
Now for testing we also need to add an extra mediator with reads the request queue , set the correlation id and put the message in the reply queue.
Add a synchronous mediator and wire to the synchronous jms adapter, complete the routing rule and finally test this in the enterprise manager.
Tuesday, October 20, 2009
JMS Request Reply Interaction Pattern in Soa Suite 11g
Labels:
jdeveloper 11g soa suite
Subscribe to:
Post Comments (Atom)

17 comments:
Hi Edwin,
Can you please share the JDev Project for this example.
Hi
you can download it here
http://www.sbsframes.nl/jdeveloper/SoaRequestReply.zip
off course you need to create 4 queues and 2 connections factories and configure two jms adapters resource adapters
thanks
Hi Edwin,
I am trying to invoke OSB Proxy service via JMS Adapter from a BPEL process. The underlying Business Service points to a composite deployed in SOA Suite 11g.I have tested the proxy service in OSB console and it works fine.
Can you explain, how to setup the correlation between invoke and receive activities in this case
Thanks in advance,
Prasanna
Hi,
ok is this your situation
bpel in composite -> jms adapter -> proxy service -> business service -> back to bpel
thanks Edwin
Hi Edwin,
Yes.I am trying to implement the scenario described in (http://oracle-soa-interop.blogspot.com/2009/02/osb-proxy-service-invocation-from-bpel.html)
Composite A is virtualised by OSB through a Business Service and associated Proxy Service which uses JMS as transport. I have tested the proxy service in OSB web console and have confirmed that once I invoke the proxy service , the composite (B) in SOA Suite is invoked and a message is put in the response queue.
I want to call the proxy from a different composite (Composite B) through a BPEL process using JMS Adapter Async Request/Reply. I am facing 2 issues
1. The request queue in OSB expects a SOAP message whereas the message passed from the JMS Adapter is not a SOAP message. Is it possible to wrap up the message in a SOAP envelope
2. How do I setup a correlation between invoke and receive activities in BPEL
Thanks for your help
Prasanna
Hi,
1 can you use messaging in the proxy service
2 in the proxy service flow you can set the transport header property correlationId on the business service.
hope this helpls
Hi,
Did you see this about request / reply in JMS and OSB http://eelzinga.wordpress.com/2009/10/28/oracle-service-bus-jms-requestresponse-pattern/
thanks
Hi,
Thanks for your help with this.I am trying something on similar lines. I have not created any JMS resources (through the WLS console) on OSB. My proxy service is based on an existing business service (which points to a composite in SOA Suite)
On the second page in the OSB proxy service creation wizard , I specify the transport as JMS and specify a request Q name and a response Q name. These queues were automatically created when I tested the proxy service.
For testing the proxy in OSB , I had to create a Business Service as specified in (http://eelzinga.wordpress.com/2009/08/06/oracle-service-bus-jms-requestresponse-response-doesnt-arrive/) and when I provide a payload to test this business service, I get the response message in the response Q
So as per (http://eelzinga.wordpress.com/2009/10/28/oracle-service-bus-jms-requestresponse-pattern/) , I might need to change my proxy service type to Any XML Service and in the message flow of the proxy service , perform a service callout to the Business service (which points to the SOA suite composite).
Can you confirm if the approach is correct
Hi Edwin,
Can you please help with this: We would like to send a JMS request to a system and wait for response (Synchrnous Request Reply). But according to documentation of JMS adapter (Step 6 snapshot of your article) it can be used in reverse situation i.e. BPEL receives a message on qeueue and replies to another queue. Can you please advise if it can be used in the scenario i described. BPEL sends a request and gets a response on a response queue.
Thank you,
Sohel.
Hi Prasanna,
you don't need to change the proxy to any xml, messaging is fine
thanks
Hi Sohel
it can be used in reverse situation i.e. BPEL receives a message on qeueue and replies to another queue
No I can not use it on the service interface, not with jdeveloper maybe this is a bug. I know it can be done in OSB .
you can always jms adapter at the service side and bpel in the middle and a jms adapter on the reference side and set the jms correlation id on the reference jms adapter.
thanks Edwin
thanks Edwin
Hi Edwin.
You said that we have to configure 2 JMS resource adapters. Can you please explain this more??
What I understand is that there are two options:
1) We have to create a new Resource Adapter that will contain the new CF. If you have followed this way, could you share your CustomJMSAdapter.rar?
2) (If this is really an option) Change the already existed "JmsAdapter.rar" under '$Fusion_Middleware_Home/Oracle_SOA1', and add our new CF. Then redeploy it.
Which option is preferred?
If I use the already existed "eis/wls/Queue" what do I loose?
I saw that this CF, in weblogic-ra.xml, is XA enabled, but the property IsTransacted=false. Could this lead to a problem?
Thanks in advance,
Rick
Hi,
You said that we have to configure 2 JMS resource adapters. Can you please explain this more??
Sorry you need to configure 2 configurations in the jms resource adapter. One with a XA CF and One with a normal CF
Don't need to copy or change jar files.
If I use the already existed "eis/wls/Queue" what do I loose?
nothing you can add your own filter
I saw that this CF, in weblogic-ra.xml, is XA enabled, but the property IsTransacted=false. Could this lead to a problem?
just check it out. it is easy to change,
thanks Edwin
Hi Edwin,
thanks for your reply.
Can I ask you one more thing.
You wrote this:
"Very important, we need to assign the message id of the jms message to the correlation id of the reply jms message".
Which is the reason to do this?
If you do not set the 'JMSMessageID', what you will loose?
Thanks again,
Rick
Hi Rick
If you do not set the 'JMSMessageID', what you will loose?
you won't loose the message but Soa suite can not find the return message and the bpel process won't continu.
thanks
Hi Edwin,
Thanks for such a good explanation.
I am working on the Synchonus Request Reply.
"jms resource adapter which has transacted on true and use a jms connection factory which is not xa transacted"
On weblogic console
Deployment>JMSAdapter>Configuration>Outbound Connection Pools
I tried creating normal CF using oracle.tip.adapter.jms.IJmsConnectionFactory. ( Assumeing this support nonxa CF)
The new jndi- eis/NonXAQueue/demo
The Outbound Connection Properties are -
ConnectionFactoryLocation = jms/aNonXADemoCF
IsTransacted = false ( as my WLS JMS is running in the local JVM, the same one as the adapter i.e.on same machine). Do i need to set it to true.
To set to non-XA. the transaction support level parameter of this outbound connection pool is set to "Local Transaction". Is this correct?
I am using this JNDI name for connecting to inbound/ outbound queues.
My Bpel process is NOT blocking but in Invoke it produce message in the OUT queue and does not wait for message in Inbound queue.
Please suggest what is missing here?
Thanks,
Shailesh
Hi,
somehow you got an other problem. if you put transacted on false in the resource adapter then xa is disabled and does the logging of the instance say, maybe a timeout.
thanks Edwin
Post a Comment