Pages

Tuesday, October 20, 2009

JMS Request Reply Interaction Pattern in Soa Suite 11g

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.

125 comments:

  1. Hi Edwin,
    Can you please share the JDev Project for this example.

    ReplyDelete
  2. 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

    ReplyDelete
  3. 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

    ReplyDelete
  4. Hi,

    ok is this your situation
    bpel in composite -> jms adapter -> proxy service -> business service -> back to bpel

    thanks Edwin

    ReplyDelete
  5. 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

    ReplyDelete
  6. 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

    ReplyDelete
  7. 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

    ReplyDelete
  8. 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

    ReplyDelete
  9. 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.

    ReplyDelete
  10. Hi Prasanna,

    you don't need to change the proxy to any xml, messaging is fine

    thanks

    ReplyDelete
  11. 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

    ReplyDelete
  12. 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

    ReplyDelete
  13. 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

    ReplyDelete
  14. 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

    ReplyDelete
  15. 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

    ReplyDelete
  16. 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

    ReplyDelete
  17. 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

    ReplyDelete
  18. Dear Edwin!!!

    Thanks for a neat explanation. I am working on a use case, where I need to orchestrate BPEL with Async Req/Reply JMS Adapter with content-based correlation and it somehow does not work.

    I was able to perform the scenario by configuring two JMS adapters, one producing/enqueuing the message and another consuming/dequeueing the message. The receive activity then correlates the incoming message and appropriate instance progresses.

    Can you please throw some light on where I might have faulted.

    ReplyDelete
  19. Hi,

    Strange i did the same with BPEL and async jms request and reply.

    I just used the invoke and receive nothing special.

    thanks Edwin

    ReplyDelete
  20. Dear Edwin!!!

    The scenario that you have explained has native correlation (using JMSMessageId and JMSCorrelationId), I want to use the content-based correlation, i.e., using orderId (a unique field in my payload) as correlation id, which does not work, it gives me an error saying -

    "The property alias was not defined correctly in the BPEL/WSDL source, or the payload is not as expected.
    Check the BPEL/WSDL source to ensure that property alias is defined correctly.
    ORABPEL-03813

    Failed to evaluate correlation query.
    failure to evaluate the correlationAlias query "/client:process/client:input" on the element ">process xmlns="http://xmlns.oracle.com/ApplJMS/JMSTest/JMSOut"<
    >input<123>/input<
    >/process>"

    But the same steps used with two JMSAdapters using Producer and Consumer, works fine. Hence, I know how to use content-based correlation.

    This thing is stumping me. If you want I can post the codebase at a place u want so that you can have a good look at it.

    ReplyDelete
  21. Hi,

    And when you use a mediator and in the assign under the routing rule set the jca.jms.JMSMessageID to this order id, does it work then.

    thanks

    ReplyDelete
  22. Dear Edwin,

    Thanks for quick response. It works using JMS Message Headers in mediation module, the problem comes when I think of working with content-based correlation, for example, orderId in my payload.

    Regards,

    Swapnil

    ReplyDelete
  23. Hi there,

    Swap: I'm working on a very similar scenario where content-based correlation is involved.
    I have followed some guides from Oracle docs (in special the "109.CorrelationSets" sample) but I didn't get the point.
    Edwind, could you help us showing us a good example about the issue in the quality line of this one?

    Thanks a lot of for your help any way.

    ReplyDelete
  24. Hi,

    Oracle made some 11g examples which can be downloaded here http://www.oracle.com/technology/sample_code/products/soa/index.html.
    and in this zip they have a test project adapters-jms-105-wlsjms-nativecorrelation

    and here some extra informatie
    Synchronous Request Reply Pattern, uses JMSReplyTo header

    Asynchronous Request Reply Pattern The correlation is done based on the JMSMessageID

    ReplyDelete
  25. Thanks for your kindly help, Edwin.

    I will share with the community in case I build any interesting scenario just to aggregate aditional info.

    Jesus.

    ReplyDelete
  26. Dear Edwin!!!

    As I said, I am able to correlate the process using JMSMessageId.

    What I am interested in is to create Correlation Set on my invoke, and check the incoming message for specified property to match the reply to request. Something like-

    <a href="http://swapnil-soa.blogspot.com/2008/01/correlation-this-post-would-effort-to.html>this link</a>

    Further More I am able to do this, if I use

    WS_Client -> Receive

    Invoke -> JMSProducer

    Receive <- JMSConsumer

    Terminate

    But if I try

    WS_Client -> Receive

    Invoke ->
    }JMSAsyncReqRep
    Receive <-

    Terminate

    the correlation, using correlation set does not work. Hope I am able to to put the picture clearer.

    ReplyDelete
  27. Hi Swap,

    it will not work and is not supported in one request / reply jms adapter. See the oracle example

    it can only work with two separate jms adapters.

    thanks Edwin

    ReplyDelete
  28. Thanks Edwin, it answers.

    -Swap.

    ReplyDelete
  29. Hi Edwin,

    Is it possible in 11g to have BPEL use a JMS Adapter which puts a message in a JMS Request Queue and then a Message Driven Bean places a message in a JMS Response queue when complete?

    Thanks and great blog!

    ReplyDelete
  30. Hi,

    That will work perfectly, the only thing you have to do, is to set the correlationID in the MDB on the JMS message in the Response queue.

    thanks

    ReplyDelete
  31. Thanks for the response. In the MDB when I try and do the response message I get a rejected message in onReject on the BPEL process. The message in the logs is that there is no callback defined in the composite. I have no Mediator just a BPEL process, a MDB, and an invoke and receive on the JMS Adapter.

    ReplyDelete
  32. And this is the specific error we get in the logs..Again we have no Mediator. We have a Composite with a BPEL process that calls a JMS Adapter. The JMS Adapter puts the message in the request queue the Message Driven Bean picks it up, does some processing and then puts a message in the response queue. This is the result of the message being put in the response queue by the MessageDrivenBean.

    Thanks so much for any help!!

    SEVERE: JCABinding=> SREUtilityMDBAdapter Service SREUtilityMDB was unable to perform delivery of inbound message to the composite default/JMSTest3!1.0*5f6b9f31-c664-4571-bb94-bcc0f466f39e due to: Cannot simply post callback message to the composite as there is no service element associated with the callback. Recommendation: add/set the JCA reference/binding property 'rejectUncorrelatedMessages' to true

    ReplyDelete
  33. Hi,

    Can you please check these Oracle jms adapter examples, There are some bpel jms request / reply examples http://www.oracle.com/technology/sample_code/products/soa/index.html

    thanks

    ReplyDelete
  34. Thank you so much!!!

    It worked perfectly. In the MDB I set the JMSCorrelationId to the incoming MessageId and it works.

    This allows us to just have a composite with one BPEL process and an asynch JMS Adapter call. The MDB puts then puts message in the response queue.

    See code below:

    StringBuilder sb = new StringBuilder();
    sb.append("");
    sb.append("Here is the response!!!");
    sb.append("");

    message.setText(sb.toString());
    message.setJMSCorrelationID(messageId);

    ReplyDelete
  35. Hi Edwin,

    I have a scenario where there is integration between a portal and a billing system using OSB. The use case is that the user fills a form in the portal and submits an order. The order details are sent to the billing system via the OSB and the billing system comes up with an order id which then needs to be displayed in the portal.

    The billing system exposes a web service to integrate with OSB and portal can make a web service call to the OSB.

    A very familiar use case but the requirements are that the order should be persisted and no duplication. QOS (reliability) is a major non-functional requirement.

    What are the approaches available to solve this kind of use case where reliability in synchronous communication is the key.

    ReplyDelete
  36. Hi Ananya ,

    In your wsdl of your OSB proxy service you can add a reference to the DefaultReliability.xml policy just like adding a security policy ( see my blog about osb and ws-security)

    this solves the portal to osb part. the billing system has to do the same, don't know if the billing is capable of supporting Reliable Messaging.

    and off course you need to handle possible error in the proxy flow so that you can not loose messages.

    or use a persistent jms queue in the middle, so you can resume from there

    thanks
    More information

    Predefined Reliable Messaging Policy Files

    As described in Use of WS-Policy Files for Web Service Reliable Messaging Configuration, WebLogic Web Services use WS-Policy files to enable a destination endpoint to describe and advertise its Web Service reliable messaging capabilities and requirements. These WS-Policy files are XML files that describe features such as the version of the supported WS-ReliableMessaging specification, the source endpoint's retransmission interval, the destination endpoint's acknowledgment interval, and so on.

    Oracle Service Bus includes two simple reliable messaging WS-Policy files that you can use (only with the WS-RM transport) if you do not want to create your own WS-Policy files:

    * DefaultReliability.xml—Specifies typical values for the reliable messaging policy assertions, such as inactivity timeout of 10 minutes, acknowledgement interval of 200 milliseconds, and base retransmisstion interval of 3 seconds. See DefaultReliability.xml WS-Policy File for the actual WS-Policy file.
    * LongRunningReliability.xml—Similar to the preceding default reliable messaging WS-Policy file, except that it specifies a much longer activity timeout interval (24 hours.) See LongRunningReliability.xml WS-Policy File for the actual WS-Policy file.

    ReplyDelete
  37. Hi Edwin,

    Thanks for your valuable inputs.
    But the issue with WS-RM is our web services that are JAX-WS based and OSB/WLS doesn't support WS-RM standard for JAX-WS based web services (the support is only for JAX-RPC based web services). So we can't use WS-RM here.

    My thoughts about use of JMS -
    If we use JMS in between then it would be a SOAP-HTTP call from Portal to ESB. Inside the ESB we will persist the request using JMS queue and then pass the request to Billing system which is again SOAP-HTTP call. Now when the response (orderid)comes from billing system we can put it into another response queue and send it back to the Portal. But the issue is how do we correlate the request and the response such that we know that the response is for which specific request. We can use JMS request/reply pattern but the billing system doesn't provide the flexibility to add the correlation id in the response (I am not sure about this bit but I assume that the correlation id doesn't get added automatically in the response and needs to be added by the billing system.)

    Correct me if I am wrong in my understanding about the use of JMS.
    Since the billing system is a black box and doesn't provide flexibility to add correlationid in the response this solution also doesn't seem feasible.

    Regards
    Ananya

    ReplyDelete
  38. Hi,

    is the billing a synchronous web service? if so then you don't have a difficult problem. Async is more complex

    make a ws proxy service which puts a message on a persistent queue with some jmsmessageid (jms business service )
    and the second jms proxy calls the billing system (ws business service) and puts the message back on the queue and fills the jms correlation id. Then the first picks its up ( maybe it is good to make the first proxy a async ws so you can recover the portal ws call by putting

    Here is some more information on osb http://eelzinga.wordpress.com/2009/10/28/oracle-service-bus-jms-requestresponse-pattern/

    hope this helps

    ReplyDelete
  39. Hi Edwin,

    Thanks for all your valuable inputs.

    Yes the billing web service is asynch and the portal can't wait for the response (orderid) from the billing service. The portal needs to display some sort of interim orderid quickly back to the user and then later the user can use that interim order id to search the order and check it's status.

    Please suggest you thoughts in such a scenario. Is there a pattern to take care of such cases or what is the suggest way to solve this kind of issue.

    Thanks and Regards
    Ananya

    ReplyDelete
  40. Hi,

    Ok I don't know if you can change the portal but the portal can generate a unique id and call a one way service ( fire and forget ) and this service call the async billing service. when the service get a reply back from the billing service it can gives the real order id back to the portal together with the unique id. or it can fill a xref table .

    thanks

    ReplyDelete
  41. Hi,
    First, I'll like to thank you for your article.On the other hand, just like some older post, I'm trying to use a message correlation, but the difference is that I'm using two simple adapters one for creating messages in one project, and another to consume them in some other different composite, so ,by the way I see it, there's no request/response scensario, on the second composite i've defined a property alias related to the message type of the consumer adapter.Everything compiles ok, but on runtime i get the infamous failure to evaluate the correlationAlias query exception. Is a must to use the mediator on 11 in order to do so? Thanks for your clarification

    ReplyDelete
  42. Hi,

    with the mediator or BPEL it should work fine.

    you can set in a Mediator assign or BPEL invoke a jms property like
    jca.jms.JMSProperty.country and add a value to this.

    and in the consuming jms adapter add in the message selector country='xxx'

    hope this helps

    ReplyDelete
  43. Hi ,
    I am using JMS Request Response option in the JMS Adapter in one of my service service1. My service would send a message to a Queue A using JMS adapter asyncronously and waits for the response by listening to Queue B.
    For the performance testing of this service I am using a stub which would read the messages being sent by my webservice from Queue A and pushes the response to Queue B ( By setting the corellation id to the message id of the request message).
    This works fine when the number of messages i send from service A are limited, but would break ones the number of invocations of service1 increases.

    The following error comes when I run, The error obviously says that it is unable to correlate, but wanted to know why its unable to correlate only when I am increasing the frequency of invocation of service1.

    <06-Aug-2010 14:21:16 o'clock BST> GetMessage JMS_KFIQUEUEAdapter Service JMS_KFIQUEUE was unable to pe
    rform delivery of inbound message to the composite default/KeyForImageService!1.
    4.7*e6ebfc69-bbc2-4ca1-a1d2-01a453a29615 due to: Cannot simply post callback mes
    sage to the composite as there is no service element associated with the callbac
    k. Recommendation: add/set the JCA reference/binding property 'rejectUncorrelate
    dMessages' to true>
    <06-Aug-2010 14:21:16 o'clock BST> GetMessage Unable to create/save Composite Instance Fault due to: nu
    ll>
    <06-Aug-2010 14:21:16 o'clock BST> GetMessage
    java.lang.NullPointerException
    at oracle.integration.platform.instance.InstanceManagerImpl.createCompos
    iteInstanceFault(InstanceManagerImpl.java:700)
    at oracle.integration.platform.blocks.adapter.fw.jca.mdb.AdapterServiceM
    DB.createCompositeInstanceFault(AdapterServiceMDB.java:1020)
    at oracle.integration.platform.blocks.adapter.fw.jca.mdb.AdapterServiceM

    ReplyDelete
  44. Hi,

    it looks a problem on the soa or jms server, you can use a different jms server then the soa server. or use a file persistence for your jms server.

    I think you are reaching a memory or thread problem. for asyn it need to have a lot of listening processes. maybe you can tweak the threads in soa server.

    thanks

    ReplyDelete
  45. Hi Edwin,
    Thanks for your reply, Just wanted to check about the request reply pattern behaviour in case of distributed queues.
    How does the correlation happen in this case.

    Thanks,
    Ajay

    ReplyDelete
  46. Hi,

    Dont know if the jms adapter is cluster aware, I think it listen on a queue on a managed node. When the msg is delivered on the other managed node. then you need to make sure that the msg is automatic transfered to the other managed server.

    thanks

    ReplyDelete
  47. Hi Edwin,
    I have an issue not related to this topic, but regarding JavaBinding in SOA 11G.
    I have created an application with Java binding for invocation of a java webservice through Parner Link.
    But when i'm testing the applocation in EM, i'm getting following exception
    "oracle.fabric.common.FabricException: Unable to find service: {http://MyPackage/}MyTestService".

    If u can share the steps for Java Binding with a sample project will be great.

    --Rupesh

    ReplyDelete
  48. Hi.

    For the java binding do you use the EJB adapter or are you using the Spring component.

    or do you call an adf / direct binding service of a composite application

    thanks

    ReplyDelete
  49. Hi Edwin,

    We have a project using correlation sets rather than native JMS correlation but was hoping that maybe you had some insight as to what happens with uncorrelated messages.

    If a message is received by a JMS adapter in a composite application that does not correlate with any running instance of a BPEL process wired to that adapter, the JMS adapter will fire in the composite application and no further processing will take place.

    My question to you is: Can you configure the JMS adapter such that uncorrelated messages can be "redirected" so that processing can occur in a BPEL process?

    BTW appreciate your work so far. Thanks.

    ReplyDelete
  50. Hi,

    interesting question, maybe you should not use jms request reply but for the return message use a mediator which dequeues everything and does some routing to the right BPEL or other queue and copy the header properties .

    let me know if this works.

    ReplyDelete
  51. Hi Edwin,
    I'm trying the something very similar to the last response. I have an inbound JMS adapter which is connected to a mediator for some porcess ...things work fine. Now the JMS header say is populated with JMSReplyTo property by the caller(ie a seperate destination queue). I just need post a message to that destination. In the mediator I can access the value with out.property.jca.jms.JMSReplyTo...
    question is how do i post a message to that queue (as provided in the JMSRepyTo).Can this is done at all...Note the jms adapter is on inbound service not on reference side where i can use the request-reply. It's a inbound adapter with the JMSReplyTo info in teh header. I need to extract it and post a simpele status message. Will appreciate if u can provide some insight into it

    ReplyDelete
  52. Hi,

    inbound it is not possible. use a OSB proxy.
    but you can use an inbound jms with a partical dequeue option and use a jms outbound reference on the same queue with a correlation of the inbound message

    thanks

    ReplyDelete
  53. Thanks for the prompt reply...is there any pointer for the inbound jms with a partical dequeue option ... I mean a little more details as what needs to be done.

    Also, just checking does writing a custom java callout in the meditaor be of any help...not sure though if the JMSReplyTo value can be accessible there or not.

    Thanking u in advance

    ReplyDelete
  54. Hi,

    your app who fills the queue must set a jms property like this

    you can set in a Mediator assign or BPEL invoke a jms property like
    jca.jms.JMSProperty.country and add a value to this.

    and in the consuming jms adapter add in the message selector country='xxx'


    here some more info over mediator assign http://biemond.blogspot.com/2009/08/jdeveloper-11g-improvments-for-mediator.html

    ReplyDelete
  55. Hi,
    Sorry to bug u again...well,I get y'r point and I can access those JMSproperty ...thats fine but what is happening here is that the app fills the queue with a ReplyJMSTo like the following

    TextMessage message = session.createTextMessage();
    message.setText(testMsg);

    replyToDestination = session.createTemporaryQueue();
    message.setJMSReplyTo(replyToDestination);

    ///then sends the message

    so the destination is already set, which is like any other JMS property i agree...and If were to write custom Listener I could have done something like

    // Get the temporary queue from the JMSReplyTo
    // property of the message...
    tempQueue = (Queue) msg.getJMSReplyTo();

    and send the message

    But since I'm using the JMS inbound adapter with a mediator ...I am not sure if I can send any message to that destination...if I define a outbound adapter i.e a consuming jms adapter ...it has its own destination (queuename)...not sure if i can change the consumer destination with the one supplied by the caller.
    Basically the caller app is looking for a request-reply over JMS. Question is can we do it with in bound JMS adapter and mediator/ mediator callout...We canot use OSB here

    Will apprecaite if you provide y'r thoughts...I know u might have already stated in y'r previous response...but just wanted to get little more clarity on the same.

    ReplyDelete
  56. Hi Edwin - You mentioned timeouts when setting a policy using OSB. But outside of OSB, is there a way to set a timeout for an asynchronous JMS request/reply? As in, we successfully put an outbound message in the queue, but if we don't get a reply in say, 5 minutes, the step will timeout and we can continue?

    Thanks!

    ReplyDelete
  57. Hi,

    Are you OSB or SOA suite. And I don't get the context of your OSB timeout remark.

    But in SOA suite I think you can set the timeout on the adapter and else in a assign of the jms property

    In SOA suite you will get an error when there is a timeout and you can handle this in bpel or in a custom fault handler.

    Thanks

    ReplyDelete
    Replies
    1. Hi Edwin,

      I am using request_replay with sync. i did not see any jms property to set reply time out. can you please help me on this.

      Thanks

      Delete
    2. Hi,

      with sync I think it uses the default JTA timeout of the container. With async you can add a mediator in soa suite before the jms adapter and set a timeout on the callback.

      Thanks

      Delete
  58. Hi
    As i was trying to use JmsCorrealtionId pattern at runtime($inbound/transport/request/header/JMScorrelationId/text()) but it was not picking up the message from the queue. could you please tell me the how to do that.

    ReplyDelete
  59. Hi,

    Are working with OSB and on the proxy service side.
    You can use a Message selector to listen always to the same jms header property. But you can't override it at runtime. you can put a message on a queue and listen for the response but this always an option in soa suite or osb. like this http://eelzinga.wordpress.com/2009/10/28/oracle-service-bus-jms-requestresponse-pattern/

    thanks

    ReplyDelete
  60. Edwin the link that you have given below is not enough to clear my doubts.I will give u an example which will give the clear picture of my doubt.

    Suppose my Proxy1 is picking the message from the Queue1 and dumping it into Queue2 through Business Service BS1. Now another 2 proxy i.e Proxy2 and Proxy3 is picking the message from Queue2 but i want that at run time i should decide which proxy will listen the Queue2(Routing of the request at run time).
    I hope you have understand.

    ReplyDelete
  61. Hi,

    Ok you can use a queue instead of a topic , then only one can pick it up.

    but what you can do is for example proxy2 only picks up messages from a queue with message selector proxy2 and proxy3 does the same but then only for the proxy3 message filter.

    in the BS you need to decide which proxy gets it and set the right jms header property with value proxy2 or 3

    thanks

    ReplyDelete
  62. Thanks Edwin for your valuable comment.

    ReplyDelete
  63. Thanks Edwin for your valuable comment.

    ReplyDelete
  64. Dear Edwin,
    Thanks for your wonderful post. Can you also post your thoughts about reliable messaging through WS transport in OSB with an example.

    Thanks in advance,
    Harini

    ReplyDelete
  65. Hi Edwin,

    Can you tell me that same targetNameSpace is possible in two different schemas or not?

    ReplyDelete
  66. Hi,

    I made a WS-RM OSB example in my coming osb developer cookbook at packt. The raw version will be available very soon.

    so you have to wait for a while.

    thanks

    ReplyDelete
  67. Hi,

    Can you tell me that same targetNameSpace is possible in two different schemas or not?

    Never do that, I know in SOA the wsdl with targetnamespace is loaded once ( import) , after that only referenced by the target namespace. You can get strange runtime errors.

    thanks

    ReplyDelete
  68. Hi Edwin,

    I am trying to write a XML String into the JMS Queue( on weblogic ) using a JMS Adapter ( i am using 11G ) , Wen i see the message in the BPEL instance , things seem to be OK , but when i look into the actual JMS Queue the '<' is replaced with < .

    I have no clue what is going wrong .

    Could you please throw some light on this.

    Cheers
    Lakhmi

    ReplyDelete
  69. Hi Edwin,

    I am trying to write a XML String into the JMS Queue( on weblogic ) using a JMS Adapter ( i am using 11G ) , Wen i see the message in the BPEL instance , things seem to be OK , but when i look into the actual JMS Queue the '<' is replaced with < .

    I have no clue what is going wrong .

    Could you please throw some light on this.

    Cheers
    Lakhmi

    ReplyDelete
  70. Hi Edwin,

    I am trying to write a XML String into the JMS Queue( on weblogic ) using a JMS Adapter ( i am using 11G ) , Wen i see the message in the BPEL instance , things seem to be OK , but when i look into the actual JMS Queue the '<' is replaced with < .

    I have no clue what is going wrong .

    Could you please throw some light on this.

    Cheers
    Lakhmi

    ReplyDelete
  71. Hi Edwin,

    I am trying to write a XML String into the JMS Queue( on weblogic ) using a JMS Adapter ( i am using 11G ) , Wen i see the message in the BPEL instance , things seem to be OK , but when i look into the actual JMS Queue the '<' is replaced with < .

    I have no clue what is going wrong .

    Could you please throw some light on this.

    Cheers
    Lakhmi

    ReplyDelete
  72. I apologize for the mistake

    the Charecter "<" is getting repalced with '&''l''t' ;

    Cheers
    Lakhmi

    ReplyDelete
  73. Hi,

    this is good behavior, you got escaped xml.

    What xsd did you use on the jms adapter and did you add this data in BPEL on an element of this xsd.
    Then you copied this xml as value of the element. This copied.xml is not part of the xml.

    If this is not the case then check the jms options, did you use text or bytemessage

    thanks

    ReplyDelete
  74. Hi Edwin,

    My component is a one way bpel which takes a string and writes into the jms queues .

    The jms input element and bpel input element share the same xsd .

    I read the string (xmlstring) as input from the client component and write the string into the JMS queues .
    The JmsQueue is configured to use textmessage .

    Please let me know if i am missing any info .

    Cheers
    Vamsi

    ReplyDelete
  75. Hi Edwin,

    My component is a one way bpel which takes a string and writes into the jms queues .

    The jms input element and bpel input element share the same xsd .

    I read the string (xmlstring) as input from the client component and write the string into the JMS queues .
    The JmsQueue is configured to use textmessage .

    Please let me know if i am missing any info .

    Cheers
    Vamsi

    ReplyDelete
  76. Thanks for nice article.
    I have a requirement like
    An xml doc with one attribute is published using JMS store. There are multiple subscribers in OSB for that JMS store document.
    How can I trigger different (one or more) subscribers based on certain value for that single attribute.
    For this scenario how can I achieve.Please give your valuable suggestions and directions.

    Thanks
    Mani

    ReplyDelete
  77. Hi
    I have deployed...can you tell me how to test,how to feed the input data from employee..i am new to this ..tell me in steps..

    ReplyDelete
  78. Hi Edwin,

    I am trying to set JMS custom properties before publishing message to queue. I can do it with Mediator. But I want to know how to set custom properties from BPEL. Can you help me with it.

    Also, I have an inbound JMS queue which polls a queue and gets the message. This message is sent to a BPEL process. Is there a way I can access the JMS properties in BPEL flow?

    Thanks in advance for your help.
    KP

    ReplyDelete
  79. Hi,

    I know you can set it in one of the tabs on the invoke action or on the partner link .

    About retrieving I need to check it out .

    Thanks

    ReplyDelete
  80. Hi Edwin this is ubaid oracle soa developer with aia pip order to cash integeration i got some error when i am running the em console in process integration for asset management i am getting the below errors Please find below the fault descriptions for Asset integration process flow Create Asset Integration Flow: 1.CREATE ITEM INSTANCE EBIZ EVENT CONSUMER Non Recoverable System Fault : ORAMED-03302:[Exception in oneway execution]Unexpected exception in one-way operation "CreateItemInstance" on reference "CreateItemInstanceEbizReqABCSImpl.CreateItemInstanceEbizReqABCSImpl_1_0".Possible Fix:Check whether the reference service is properly configured and running or look at exception for analyzing the reason or contact Oracle Support Services ----- could be due to some security certification path exception CREATE ITEM INSTANCE EBIZ REQ ABCS IMPL Non Recoverable System Fault : FabricInvocationException ------ Invocation failure 2. QUERYITEMINSTANCEEBIZADAPTOR: No FAULTS 3. CREATITEMINSTANCEEBIZREQABCSIMPL FabricInvocationException------- Invocation Failure 4 INSTALLEDPRODUCTEBSV2 NO FAULTS 5 CREATEASSETSIEBELPROVABCSIMPL NO FAULTS Update assets integration flow: 1.UPDATEITEMINSTANCEEBIZEVENTCONSUMER Non Recoverable System Fault : Resource adapter invoked onReject() without an associated exception The payload details for this rejected message can be retrieved---- BPEL processing, and between, using the same example, BPEL and the Database Adapter, where messages requesting, for example, an insert are written. With a synchronous transaction, a retryable error is not caught by BPEL (the example intermediary) within the composite; the transaction returns all the way back to the JMS adapter for possible global retry. ■ The synchronous transaction is just one JTA transaction, rather than two. ■ The Adapter rejection table keeps a record of adapter rejections. Within the context of a synchronous transaction, local BPEL error handling is bypassed, and with a synchronous transaction. 2.QUERYITEMINSTANCEEBIZADAPTER NO FAULTS 3.UPDATEITEMINSTANCEEBIZREQABCSIMPL Non Recoverable System Fault : oracle.fabric.common.FabricInvocationException---- Invoaction failure 4.INSTALLEDPRODUCTEBSV2 NO FAULTS 5.UPDATEASSETSIEBELPROVABCSIMPL NO FAULTS I just want to rectify the faults in the bepel hope to get the response soon

    ReplyDelete
  81. Hi Edwin,

    the above case is very much possible in JMS or MQ. But how can we achieve the same (Asynchronous Invocation of DB Adapter) in the BPEL process. As far as I know there is no such operation in DB Adapter.

    Please give me some advice on it.

    Thanks
    Sunil

    ReplyDelete
    Replies
    1. Hi,

      I don't know the use case but waiting for a db adapter can't be that long that you need asynchronous else you should tune it or you will get a JTA timeout. But maybe you can add a request to AQ which start this db actions and listen on AQ for the results.

      thanks

      Delete
  82. Need help on using a message selector on a jms proxy service. The message selector should be based on the body of the xml. When i publish the message to the queue using a BS I tried setting the JMSType to weblogic.jms.extensions.XMLMessage and the selector to in the PS to JMS_BEA_SELECT('xpath','/order/ordertype/text()')='new'. But the PS is not able to pick up any messages in the queue. Sample xml message new

    Also where can i can find documentation about the jms_bea_select function ? and notes on what expressions can be used in message selector ?

    ReplyDelete
    Replies
    1. Hi,

      I think you already saw this doc http://docs.oracle.com/cd/E13222_01/wls/docs81/jms/implement.html#1186875

      it looks like it is a custom java thing
      String sel = "JMS_BEA_SELECT(`xpath', `/order/item[2]/name/text()') = `Mitre Saw'";
      qsession.createReceiver(queue, selector);

      I think OSB follows a more strict jms implementation cause it can also connect to different jms providers.

      thanks

      Delete
  83. Hi Edwin,

    Thanks for this wonderful article.

    I am stuck with a trivial thing, and would be grateful if you could help me out.

    I am trying to create a JMS Consumer using Oracle Mediator 11g. This mediator will read from a JMS queue. However, the queue might have XML messages conforming to multiple schemas (XSDs). This mediator of mine should dequeue XMLs conforming to only one particular schema.

    Can you please show me how this can be done?

    Regards,
    Raj

    ReplyDelete
    Replies
    1. Hi,

      can you set a jms header property with the schema name and use a message filter.
      or just dequeue everything and add a transformation, I think with the right schema you get meaningful data and the others you get an empty message. Ignore empty messages in BPEL.

      thanks

      Delete
    2. Hi Edwin,

      Thanks for your reply.

      The scenario I am trying to implement is:

      Our JMS queue contains two kinds of XML messages - one conforming to schema1.xsd other conforming to schema2.xsd.

      We have 2 consumers (mediator or BPEL) which read from this queue. Mediator1 should pick up schema1 and Mediator2 should pick up schema2.

      So, your 2nd option wont work for us, and option 1 seems to be the only way to go.

      Can you please throw some more light on the 1st option (using message filter on a field in JMS Header)?

      Regards,
      Raj

      Delete
    3. Hi,

      Your producer application or service should set a jms header property with a identifier.
      you can set in a Mediator assign or BPEL invoke a jms property like jca.jms.JMSProperty.country and add a value to this.

      and use a message filter on the jms adapter of your soa composite and use like country='NL'

      thanks

      Delete
  84. Hi Edwin,
    Thank you very much for this great know-how sharing!

    I am using SOA 11g and struggling with the following scenario, which I hope someone can help:
    Two composites (compA and compB).

    In between these two SOA composites communication there are two queues (requestQueue1, responseQueue1).

    The flow is, that BPEL from compA uses a JMS Request/Reply adapter (external references) in order to enqueue in the request queue (e.g. requestQueue1) and compB will dequeue from the request queue the message, process it and return it to the respective response queue (e.g. responseQueue1).

    I thought that I could do that by having one request/reply jms adapter in each composite, but it looks like this is not the case since although compA works fine, when trying in compB to put a Request/Reply JMS adapter in the EXPOSED SERVICES area, since it will receive a message, process it and send it back, it AUTOMATICALLY moves the JMS adapter from the EXPOSED SERVICES area to the EXTERNAL REFERENCES area!

    If in compB I use two JMS adapter: one Consume and one Produce, it works fine.

    Cannot figure out if JMS Request/Reply Adapter is supported by Composite Exposed Services?

    Thank you in advance for your help,
    Alex

    ReplyDelete
    Replies
    1. Hello Edwin,

      After further searching for related questions, I have come across to two of your past replies:

      Yet, for double checking it would be very helpful, if we could say that this is still the case and the issue in not resolved, even for my described scenario.

      Thank you very much,
      Alex

      P.S.
      JDEVELOPER 11.1.1.5.0

      /////////////////////////////////////////
      Building an asynchronous web service with OSB.

      http://biemond.blogspot.in/2011/02/building-asynchronous-web-service-with_27.html

      “1. RajaMarch 11, 2011 4:13 AM
      Hi Edwin,
      Have a question for you... slightly related to this blog but not fully...so excuse me for the same...I have a situation where the SOA Composite can only be initiated thr JMS...is it possible to modify the inbound JMS adapter with request-reply options for inbound service from the clinet. I know it works fine as a "reference" but I need the same for inbound service. If it is not possible, is there any way I can access the header properties of the JMS message from the inbound JMS adapter...that way say if I could access the JMSReplyTo property...I can send a msg back accordingly.Any help in this regard is greatly appreciated.We are using Oracle SOA 11g (11.1.1.3) vesion
      ReplyDelete

      2. Edwin BiemondMarch 11, 2011 7:17 PM
      Hi,
      I think Inboud request / reply jms works with OSB Proxy but not with a SOA Composite. here you can use it as reference. but you can use a inboud and outbound jms adapter in a soa composite and set the correlationId
      yes you can retrieve and set all the jms adapters properties.
      Thanks”
      /////////////////////////////////////////////
      Or further above this topic:
      JMS Request Reply Interaction Pattern in Soa Suite 11g

      AnonymousOctober 29, 2009 11:19 PM
      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.

      Edwin BiemondOctober 30, 2009 12:04 AM
      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

      Delete
    2. Hi,

      You are right , it is only supported on the reference side, I don't know why. In a OSB proxy it is possible

      Thanks

      Delete
    3. Thank you very much Edwin!

      Delete
  85. Thanks Edwin for such a useful post !!

    However I am getting the exception :

    The selected operation process could not be invoked.
    An exception occured while invoking the webservice operation. Please see logs for more details.
    oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: Client received SOAP Fault from server : Waiting for response has timed out. The conversation id is null. Please check the process instance for detail.

    The message is consumed from the response queue by the JMS Adapter, but while receiving the response in the callback from the adapter, the invocation is timing out.
    I tried running your code as well on my system. But I am getting the same error.
    My configurations:
    JMS Adapter: Asynchronous Request Response
    Connection Factory : Non-XA
    Adapter connection pool: IsTransacted = false
    My Composite: BPEL --> JMS Adapter

    Any help would be appreciated !!!

    Thanks

    --Sumit

    ReplyDelete
    Replies
    1. Hi,

      did you put the messageid of the jms request in the correlation header of the response.

      thanks

      Delete
    2. Hi Edwin,

      Thanks for your response !!

      Yes, I did put the JMSMessageID of the JMS Request in the Correlation id.

      Following is the property being set.

      jca.jms.JMSMessageID=jca.jms.JMSCorrelationID

      --Sumit

      Delete
    3. Hi,

      try to analyse the instance in the enterprise manager and pause the consumption of the queues and do the same with my examples. There must be some difference

      thanks

      Delete
  86. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  87. This comment has been removed by the author.

    ReplyDelete
  88. The synchronous request reply pattern is working for me when I set the istransacted property in the JMSadapter config to false, if it is set to true then I get an exception.BINDING.JCA-12563 Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Request_Reply' failed due to: [Connector:199175]This ManagedConnection is managed by container for its transactional behavior and has been enlisted to JTA transaction by container; application/adapter must not call the local transaction begin/commit/rollback API. Reject event LOCAL_TRANSACTION_STARTED from adapter.". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.I am using 11.1.16.6 version of Jdev and WebLogic Server 10.3.6.0. Everything is running in same domain.

    ReplyDelete
  89. Hi Edwin,

    I have a composite using the JMS consumer and producer adapters.
    A webservice receive the request, pass it to a mediator and this routes the request to a BPEL, the BPEL invoke the producer to store the request into a UDQ.
    For the consumer is an inverse pattern, the consumer pops the message from the queue, pass it to a mediator, then is routed to a BPEL and finally is sent to a web service.

    The problem I'm facing is in the consumer side. When the BPEL fails to send the message to the web service, the consumer JMS adapter is automatically retrying again at 12:00 AM for every 5 minutes until 4 AM approximately.

    I'm using a UDQ with a connection factory checked as TX and in the JMS Adpater deployment, the property "isTransacted" for this outbound connection is set to false.

    Do you have any idea how to change this behavior? I tried setting the delivery failure properties of the queue to redelivery limit=3 and redelivery delay override=1000 but it doesn't seem to work.

    Thanks

    ReplyDelete
    Replies
    1. Hi,

      take a look at the advanced options of soa suite , there is a mbean.
      soa trouble

      but you should build a error hospital and kill the bpel instance with the fault policies and let error hospital do the retry.

      thanks

      Delete
  90. Hi Edwin,

    We have a scenario in which we need to read messages from queue.
    Scenario is like this :

    All the messages will contain a selector (another process name). I want to have a async process and i want to have a JMS invocation, which should return all the messages with that process name.

    can we do any kind of message aggregation?

    Thanks
    PavanKumar

    ReplyDelete
    Replies
    1. Hi,

      Not possible , you need to have a process for every composite name and use that as filter on the queue. or have 1 composite which gets all messages and use a mediator for routing to the right sub process.

      thanks

      Delete
  91. Hi Ediwn,

    I had a question about understanding a SOA pattern. Is this the correct post? If not please let me know the correct post.

    Thanks.

    ReplyDelete
  92. Hi Edwin,

    I have a situation

    One BPEL Service acts as a Publisher and puts messages into JMS Topic,
    Set of other BPEL Services which acts as a Subscribers , consumes messages from the JMS Topic using 'Message Selector'.now i need to have this Message selector as a dynamic one,which can be altered from console as the code has to be changed and deployed everytime the message requirement changes.

    Tried using DVM from MDS ,but not sure how to refer them in the subscriber JMS Topic 'Message Selector'

    Please suggest a solution as this is quite urgent.TIA

    ReplyDelete
    Replies
    1. Hi,

      you can do this in the EM when you go to the composite and select the jms adapter.
      In the property tab you can manually change the message selector.

      or from your own application change the soa mbean -> oracle.soa.config -> your composite -> SCAComposite.SCAService -> your Adapter -> AdapterBinding and open the properties attributes

      Thanks

      Delete
  93. Hi Edwin,

    We have a requirement where one BPEL is publishing the message to the JMS queue. Another BPEL will be invoked by a Scheduler one's in a day and then this BPEL should consume the message from the Queue. Can we use JMS Request Reply for this?

    I created a POC where I am publishing the message to Sample queue form one BPEL. Another BPEL is trying to consume message using Request -Reply. Its consuming same message which I am sending from Invoke of Request Reply not the message published by another BPEL.

    ReplyDelete
  94. Re: JMS Adpater Question
    Posted: Feb 14, 2013 8:37 AM in response to: 905329 Reply

    Hi ,

    I am setting '1234' to JMS message ID while publshing the message to JMS . In JMS Reply I am setting '1234' in the JMS Correlation ID. But I am still getting the same error message.

    Fault ID rejected:60006
    Fault Time Apr 13, 2012 4:44:31 AM
    Non Recoverable System Fault :
    Cannot complete callback since unable to retrieve SourceURI/Wire from Correlation store. Either Instance Tracking is diabled or no corresponding Request succeeded prior to this callback
    The payload details for this rejected message can be retrieved



    Can you help me ?



    ReplyDelete
    Replies
    1. Hi,

      dont set your own message , just retrieve it and maybe store it somewhere in your message and put it back and set the jms correlation id.

      hope this helps.

      thanks

      Delete
  95. Hi Edwin,

    I am trying this in Async JMS Request Reply .I am using same queue for Request or Response .Also publshing messages to the same queue from different BPEL. JMS Request Reply is only dequeue the same message send by invoke and rejecting the message publised by other BPEL

    ReplyDelete
    Replies
    1. Hi,

      Can you use different queues, don't think it works on the same queue cause I don't see a message selector on the first queue.

      Thanks

      Delete
  96. Hi Edwin,

    Thanks for this elaborate explanation. However I'm trying to implement a scenario where I want to put a message in a JMS Queue using a synchronous BPEL process whose correlation Id (or Message Id) I want in response back and pass it to an upstream application.
    That application can trigger a different operation again with that correlation ID to invoke my consumer which should go and fetch the corresponding message based on that correlationId from JMS Queue and pass it back to the upstream Application.
    Two questions:
    1. Is this scenario possible ?
    2. How to get the correlation Id in response of the synchronous BPEL and then pass it to JMS Consumer to get the appropriate response ?

    Any pointers to it will be really helpful.

    Thanks.
    Saurabh

    ReplyDelete
    Replies
    1. Hi,

      Don't know if you should do JMS request /reply in a synchronous BPEL ( maybe get a timeout when it is not handled in 30 seconds) or do you mean fire and forget and get the messageid back of the jms adpater and pass it to the application in a response.
      you can retrieve or set jms header properties on the invoke or in a mediator in between bpel and jms adapter.

      In your application you can do with java a jms retrieve with a custom message selector which only retrieves a particular message.

      Thanks

      Delete
  97. Many thanks for your post!

    I have doubts about my case.

    I have two bpels flows. The first, recieve a xml message and this message I put into a queue. So the second bpel flow, get the message and process it.

    My doubt is how to set the environment so that I have only one consumer. I have noticed that although I have put adapter.jms.receive.threads = 1 the processes creates hundreds of instances.

    What do I have to do to avoid it?

    I would appreciate any suggeston

    ReplyDelete
    Replies
    1. Hi,

      Don't think you should change this behaviour, every jms message is one BPEL instance, just like HTTP. if you want to combine some messages (not 100 or more, just a few ) you can use BPEL correlation. this way BPEL will wait for the next message which contains a certain value.

      What is your use case ?

      thanks

      Delete
    2. Hi, Thanks for you prompt reply!!

      My case is

      1) I have a Bpel that has a file adapter which read a XML file with 32 thoudand customerID
      2) In this bpel, I make a group of 200 hundreds customerID and I send this group to a JMS

      3) A second Bpel reads the queue, gets this group of CustomerID and call a Webservices which return my customers details. A XML with at least 60 XML tags.

      4) Finally, the webservice´s return is sent to a FileAdapter which writes the XML with the customer detais into a file system.

      My problem is that the webservces which return the customer´s data has performace limitations and I must have only one instance of the bpel that reads the queue. I have noticed that several instances has been created and each one is sending 200 customerID to the webservice. As a result, the webserver that host the websevice is busy and somtimes it goes down.

      How could I avoid too many instances? I have put this properties like adapter.jms.receive.threads in my composite.xml but it does not work.




      Delete
    3. Ok,

      you can use OSB throttling to protect your web service or use this with a JMS JCA adapter

      <service name="ReadQueue">
      <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/demoreadqueue1#wsdl.interface(SampleInbound_PortType)"/>
      <binding.jca config="Dequeue_jms.jca">
      <property name="minimumDelayBetweenMessages">1000</property>
      <property name="singleton">true</property>
      </binding.jca>
      </service>

      singleton property is used in case of a clustered environment.

      Delete
    4. Thanks for your tips!!!

      My project is working fine after I follow your advice!

      Regards!!

      Delete
  98. Hi Edwin,

    Very good post, this is helping me a lot. I do have a question, though. I am trying to modify your example slightly, but I am not sure how to go about. Here is the scenario :
    1. Request comes in, BPEL receiveInput receives the message.
    2. Invokerequest_jms sends the message out
    3. Receive_response_jms is waiting for the reply message.
    4. While it is waiting, another message comes in, which is identical to the first one.
    5. Invoke_request_jms now fails, because the process instance knows that another process instance is still waiting for a reply on the same request.

    I was able to get this working with correlation sets, but I am looking for an alternative way to get it working. My reason for not using correlation sets is that I cannot use it with more than one callback, due to a bug in the current version (11.1.1.5) and upgrading is not an option at the moment.

    Thanks for any advice / help !

    Regards, Jacques

    ReplyDelete
    Replies
    1. Hi,

      Do you mean you got the same JMS messageId twice, or do you set the message ID with a value which comes from the body.

      Can you explain the use case?

      Thanks

      Delete
    2. Hi Edwin,

      The scenario I am describing above is not what is happening. It is what I would like to achieve. Sorry that I was not clear on that.

      So steps 1-3 is in line with your example. But I want to achieve steps 4-5.

      In step 4, a duplicate message is sent to the BPEL process. With duplicate, I mean from a payload / business perspective. So the BPEL process is still waiting for a reply on the JMS queue for the earlier (identical) message.

      In step 5, I want the BPEL process to be smart enough to know that it has already received an identical message, so it should tell the sender that it is still waiting for a reply on the first request.

      So here is the flow :

      a. Client sends message A to BPEL process.
      b. BPEL process sends message A to request queue.
      c. BPEL process waits for response from the response queue.
      d. While BPEL process is waiting, client re-sends message A to BPEL process.
      e. BPEL process knows that it is still waiting for a reply from the response queue, for message A. It therefore raises an error back to client, telling it that it is still processing the request, and the the second message will therefore not be processed.

      As I said, I did get this working using a correlation set (using the 'business' message ID in the payload to correlate on). In that case, if the BPEL process receives another message with the same 'business' message ID, it raises a 'Conflicting Receive Error', and that is exactly what I want...

      Delete
    3. Hi Edwin,

      Any ideas? If not, maybe you could just give me advice on how to set the jms messageID in your example to a custom value? At the moment it's set natively. I tried setting it via the properties tag in the invoke action (property jca.jms.JMSMessageID) but when I look on the queue, the ID still has the native value.

      Thanks,
      Jacques

      Delete