Oracle Service Bus, JMS Request/Response pattern

Inspired by the article of Edwin about JMS Request Reply Interaction Pattern in Soa Suite 11g, i will show a little example of what functionality Oracle Service Bus supplies to implement the jms request/response (reply) pattern.
The solution is quiet simple.

Create the wls resources

  • Create JMS Server, MyJMSServer
  • Create JMS Modules, MyJMSResources
  • Create a Connection Factory, MyConnectionFactory
  • Create 2 queues, MyQueueIn (request message), MyQueueOut (response message)

wls_resources

Create the osb resource

  • Create a new proxy service, JMSRequestResponsePS
  • ps_1
    ps_2
    For the Endpoint URi, insert the url to In-queue
    ps_3
    Check the ‘Is Response Required’ option.
    We will use JMSCorrelationID for the Response Correlation Pattern.
    For the Response URI, insert the url to the Out-queue
    ps_4

Testing
Now test the flow by insert a little xml message in the MyQueueIn queue, wait a few seconds and check the MyQueueOut queue.
Only thing what’s left is to fill in the message flow of the proxy service and add some logica.

Original blog

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

17 Responses to “Oracle Service Bus, JMS Request/Response pattern”

commenter

Hi eric, very useful post, I have another case, I must listen from one queue then forward every message to two different queue, how could I do that?, Now I already made one business service, but it only forward to one queue only.

Really thanks in advance.

Eric Elzinga | May 2nd, 2010 at 8:55 am
commenter

So all messages must be forwarded to both queues? (duplicated?)

commenter

yeahh…it’s completely true..

commenter

additional info : in my case, osb need to listen that queue and forward it to multiple application (with different queue too), who consumes the same message for different needed.

any suggestion?

Eric Elzinga | May 2nd, 2010 at 9:25 am
commenter

Since you don’t need any logic based on the messages, i would say you could make us of the ‘Store-And-Forward’ mechanisme in the Weblogic Server itself. See this : http://download.oracle.com/docs/cd/E12840_01/wls/docs103/saf_admin/config_jms.html

Is that what you need? Don’t think you need osb in here, since you you don’t execute logic on the messages. If you do want to let all the messages get processed by some OSB process, you could always use a for-each loop and do several service call outs in it. So you don’t route to the business service but you do several call outs,depending on the amount of the ‘consumers’ you have.

commenter

Hi eric, thanks for your aid, I prefer publish to service callout, and it works great now…

I think the best approaching is using SAF but I’m still learning on it :d.

Thanks

K

commenter

Hi, I’m new in JMS and OSB and testing this scenario.
Could you write for me sample test message for MyQueueIn?

commenter

Hi,

We have a requirement to consume message from JMS queue once in a day . I thought of using JMS request -reply.
I have another BPEL process publishing messages to Sample queue.

Another BPEL which will be invoked by Scheduler I have implemented JMS request reply but the problem is to the Sample queue. I am only getting the message back which I am sending using Invoke activity and not getting message published by another BPEL to Sample Queue.

Can you please help?

commenter

So in the sample queue you only find the messages which get stored directly by use of your ‘first’ bpel process. And the messages which should get stored from the bpel which is called by the scheduler won’t get stored in the queue. Correct ?

commenter

Hello Eric, Your posts are really helpful.
I have a question, can we publish the POJO object returned by java callout to Messaging service to publish onto queue.

My requirement is:

1) Process the request and build a POJO object (this i can do using java callout and return pojo stored in variable in message flow)

2) Have to Publish the POJO object to JMS Queue as object message (for this i have written service to put on queue. I am replacing the body content with .

This shows publishing successful, but null object is placed on queue.

Can you please suggest.

commenter

I haven’t tested this myself i must say. In this blog i only tested the receive part of the java object.

When you inspect the $body in the publish activity with the osb debugger, do you see content in it ? or when you use the java object as input for some dummy java callout, is the object itself not empty ?

commenter

Hello Eric, thanks for immediate response…I see the body content replaced with java-content ref=…… etc.

In my Proxy Message flow, i am replacing the body content with below, and invoking the Publish activity(to call business service which is of type Message Service with request type as Java, and Response as None). Here pojoObj is the Response of Java Callout and i am storing as this variable.

ctx:java-content ref=’pojoObj’ xmlns:ctx=”http://www.bea.com/wli/sb/context”

My question : Is this right way of invoking and replacing body content ??
Appreciate if you can give steps for publishing the POJO object to queue using OSB proxy or business service. i am suspecious on the ctx:java-content usage.

commenter

Finally i got this working.

1)
I have to check the “Return as Reference parameter” checkbox on the Java Callout.
And assigned Return Value to variable “pojoObj”

2)
And I replaced the $body/* with $pojoObj

This is worked, OSB automatically storing the object in cache and assigned as

When i refer the object with $pojoObj the above con:java-content is replaced in the body.

Earlier i tried to replace the body content using the ref:jcid:pojoObj this is wrong.

I just have to use the variable $pojoObj, this refers the cached obj in pipeline.

Anyways thanks..

commenter

Hi Eric, Your posts are really helpful. I’m testing with text messages in queues. The message has two parts separated by the “Pipe”. How do I define and assign the structure of the message with variables? Such that when it will read the message, each part is assigned to the corresponding variable. For example the following message: “serviceA|Hello serviceA”.
I am using OSB 11g version 11.1.1.7, WebLogic Server version 10.3.6.0, OEPE version 3.7.1

commenter

Hi Arturo,

You could use 2 assigns and use the function substring-before, substring-after to assign those values to your 2 variables?

commenter

Please add me to the group

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>