OSB JMS transaction

I'm trying to setup a proxy service to dequeue a message from JMS and submit to a business service. If the business service fails, I want the jsm message to remain in the queue/"rollback". I setup a queue CF with "XA Connection Factory Enabled", and I have a proxy service dequeueing from a queue through that connection factory. In the proxy service I have the "Is XA Reuired" box checked on the "JMS Transport" tab, and in the message flow, I have a route node with an exception handler that is calling the business service that I have setup to fail on purpose. The exception handler has a Reply "with failure" action.
OSB-PS -> JMS -> OSB-PS -> OSB-BS -> Failing Service
I want this to roll back to the JMS queue.
Did I miss anything in setting up the XA support for this process? When I invoke the proxy service, it errors off, but the message doesn't get rolled back to the original queue.
Does anyone have an example or docs on how to set this up?
Thanks for any help.

Hi All,
I have checked the Retry with Application Errors, but no change.
Also have a Routing Option set to "Exaclty Once".
There is also a Route error handler where I raise an error and Reply with Failure.
The JMS Connection Factory used is XA enabled and so is the JMS Proxy service.
The strange thing I observe is when the endpoint server is down, teh transaction gets rolled back and remains in the queue.
However, when the server is up but the path of the URI given is either incorrect(404 HTTP Response) or there is an internal server error(500 HTTP response),
the message is picked up from the queue and is lost.
What I am supposing the reason would be, the proxy is able to make connection to the http uri but there is an error from the business service, while in the first case, the server is not up and hence the connection itself is failing and the transaction is getting rolled back at the request pipeline level itself.
I compared the logs when server is down and when the path is not found-> the difference I found was
1. Server is down: Fault occurs in the flow of the Request flow of the Route node
2. Server is up but path not found or internal error: Fault is thrown in the response action after getting the HTTP response.
I have even tried Raise Error and Reply with failure at the Service Error Handler level as well, but the message is lost :(
Could anyone please help me out on this? Is there any workaround for the same?

Similar Messages

  • OSB jms clustering - load balancing seems to be not working

    Hi All,
    I have one admin server and two managed servers running ( one of these managed server is running in the remote linux machine) in a cluster
    I have connectionfactory created with load balance enabled with round robin
    and server affinity is disabled
    I have queue created as uniformly distributed Q
    I have a proxy service with load balancing as roundrobin and endpoint URL as below
    jms://rdoelapp001011:61703,rdoelapp001013:61703/synergyConnectionFactory1/MM_gridQ0
    If I execute this proxy sending messages it always go to one server only. There is no message going to the other server.
    If I shutdown the server that receives messages then the other server is receiving messages. Seems like fail-over is working but not the load-balancing
    There is one point may be worth mentioning here is, from the admin console if I look at the servers for the clusters it has below information
    Name      State      Drop-out Frequency      Remote Groups Discovered      Local Group Leader      Total Groups      Discovered Group Leaders      Groups      Primary      
    synergyOSBServer1     RUNNING     Never     0     synergyOSBServer1     1     synergyOSBServer1     *{synergyOSBServer1}*     0          
    synergyOSBServer2     RUNNING     Never     0     synergyOSBServer1     1     synergyOSBServer1     *{synergyOSBServer1, synergyOSBServer2}* 0
    one server has groups as {synergYOSBServer1} instead of {synergyOSBServer1, synergyOSBServer2}. Does that look correct?
    here is my jms xml file
    <?xml version='1.0' encoding='UTF-8'?>
    <weblogic-jms xmlns="http://xmlns.oracle.com/weblogic/weblogic-jms" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-jms http://xmlns.oracle.com/weblogic/weblogic-jms/1.1/weblogic-jms.xsd">
    *<connection-factory name="synergyConnectionFactory1">*
    *<sub-deployment-name>synergySubDeploy1</sub-deployment-name>*
    *<default-targeting-enabled>false</default-targeting-enabled>*
    *<jndi-name>synergyConnectionFactory1</jndi-name>*
    *<client-params>*
    *<client-id-policy>Restricted</client-id-policy>*
    *<subscription-sharing-policy>Exclusive</subscription-sharing-policy>*
    *<messages-maximum>10</messages-maximum>*
    *</client-params>*
    *<transaction-params>*
    *<xa-connection-factory-enabled>false</xa-connection-factory-enabled>*
    *</transaction-params>*
    *<load-balancing-params>*
    *<load-balancing-enabled>true</load-balancing-enabled>*
    *<server-affinity-enabled>false</server-affinity-enabled>*
    *</load-balancing-params>*
    *<security-params>*
    *<attach-jmsx-user-id>false</attach-jmsx-user-id>*
    *</security-params>*
    *</connection-factory>*
    <uniform-distributed-queue name="errorQ">
    <sub-deployment-name>synergySubDeploy1</sub-deployment-name>
    <default-targeting-enabled>false</default-targeting-enabled>
    <jndi-name>errorQ</jndi-name>
    <load-balancing-policy>Round-Robin</load-balancing-policy>
    <forward-delay>-1</forward-delay>
    <reset-delivery-count-on-forward>true</reset-delivery-count-on-forward>
    </uniform-distributed-queue>
    <uniform-distributed-queue name="undlvQ">
    <sub-deployment-name>synergySubDeploy1</sub-deployment-name>
    <default-targeting-enabled>false</default-targeting-enabled>
    <jndi-name>undlvQ</jndi-name>
    <load-balancing-policy>Round-Robin</load-balancing-policy>
    <forward-delay>-1</forward-delay>
    <reset-delivery-count-on-forward>true</reset-delivery-count-on-forward>
    </uniform-distributed-queue>
    *<uniform-distributed-queue name="MM_gridQ0">*
    *<sub-deployment-name>synergySubDeploy1</sub-deployment-name>*
    *<default-targeting-enabled>false</default-targeting-enabled>*
    *<jndi-name>MM_gridQ0</jndi-name>*
    *<load-balancing-policy>Round-Robin</load-balancing-policy>*
    *<forward-delay>5</forward-delay>*
    *<reset-delivery-count-on-forward>true</reset-delivery-count-on-forward>*
    *</uniform-distributed-queue>*
    <saf-imported-destinations name="synergySAFImportedDest1">
    <sub-deployment-name>synergySubDeploy1</sub-deployment-name>
    <default-targeting-enabled>false</default-targeting-enabled>
    <saf-queue name="gridQ0">
    <remote-jndi-name>MB_gridQ0</remote-jndi-name>
    <local-jndi-name>gridQ0</local-jndi-name>
    <non-persistent-qos>At-Least-Once</non-persistent-qos>
    <time-to-live-default>0</time-to-live-default>
    <use-saf-time-to-live-default>false</use-saf-time-to-live-default>
    <unit-of-order-routing>Hash</unit-of-order-routing>
    </saf-queue>
    <jndi-prefix>MB_</jndi-prefix>
    <saf-remote-context>synergySAFContext1</saf-remote-context>
    <saf-error-handling>synergySAFErrorHndlr1</saf-error-handling>
    <time-to-live-default>0</time-to-live-default>
    <use-saf-time-to-live-default>false</use-saf-time-to-live-default>
    <unit-of-order-routing>Hash</unit-of-order-routing>
    </saf-imported-destinations>
    <saf-remote-context name="synergySAFContext1">
    <saf-login-context>
    <loginURL>t3://rdoelapp001013:7001</loginURL>
    <username>weblogic</username>
    <password-encrypted>{AES}z9VY/K4M7ItAr2Vedvhx+j9htR/HkbY2LRh1ED+Cz5Y=</password-encrypted>
    </saf-login-context>
    <compression-threshold>2147483647</compression-threshold>
    </saf-remote-context>
    <saf-error-handling name="synergySAFErrorHndlr1">
    <policy>Log</policy>
    <log-format xsi:nil="true"></log-format>
    <saf-error-destination xsi:nil="true"></saf-error-destination>
    </saf-error-handling>
    </weblogic-jms>
    Any help will be greatly appriciated
    Edited by: 818591 on Feb 16, 2011 11:28 AM

    I am not getting you here "the right approach is to make OSB run on the man server cluster and not on admin server. "
    I have a jms proxy service that I created from admin console
    And also I have gone thru the step 5 in the link below
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/deploy/config.html#wp1524235
    If I am not wrong, the proxy service endpoint URI determines where it is pointing to. If it is a cluster environment, it should point to a clustered address
    My proxy has below endpoint URI
    jms://rdoelapp001011:61703,rdoelapp001013:61703/synergyConnectionFactory1/MM_gridQ0
    and rdoelapp001011:61703,rdoelapp001013:61703 is my cluster address
    As per your suggestion "To fix your problem, *make osb to run on the cluster* and specify the same URL for the jms proxy service"
    Could you please provide some instruction how would I "make osb jms proxy service to run in a cluster"
    As a note, I have Q defined as a distributed Q and connection factory targets to the cluster. UDQ also targtes to the cluster.
    Just for a testing I have created another manged server running local to the machine where my admin server is running
    And I created a proxy by following steps as I mentioned above and with endpoint URI as below
    jms://rdoelapp001011:61703,rdoelapp001013:61703,*rdoelapp001011:61700*/synergyConnectionFactory1/MM_gridQ0
    where the new address of my cluster is rdoelapp001011:61703,rdoelapp001013:61703,rdoelapp001011:61700
    It did create consumers in both the managed servers in the cluster that are running locally, but no consumers in the remote managed server.
    So I am kind of leaning towards thinking that there is some incorrect setup for the remote managed server and may be admin server is not able to communicate to the remote server for some reason but not sure about it..
    As a note the cluster is setup to communicate using "unicast" channel
    and I created a channel in each manged server with the same name
    here is the cluster configuration
    <name>synergyCluster1</name>
    <cluster-address>rdoelapp001011:61703,rdoelapp001013:61703,rdoelapp001011:61700</cluster-address>
    <default-load-algorithm>round-robin</default-load-algorithm>
    *<cluster-messaging-mode>unicast</cluster-messaging-mode>*
    *<cluster-broadcast-channel>synergyChannel1</cluster-broadcast-channel>*
    *<number-of-servers-in-cluster-address>3</number-of-servers-in-cluster-address>*
    </cluster>
    here are the twoOSBserver configuration
    <server>
    <name>synergyOSBServer1</name>
    <machine xsi:nil="true"></machine>
    <listen-port>61703</listen-port>
    <cluster>synergyCluster1</cluster>
    <web-server>
    <web-server-log>
    <number-of-files-limited>false</number-of-files-limited>
    </web-server-log>
    </web-server>
    <server-debug>
    <debug-scope>
    <name>weblogic.jms.saf</name>
    <enabled>true</enabled>
    </debug-scope>
    <debug-jmssaf>true</debug-jmssaf>
    <debug-saf-sending-agent>true</debug-saf-sending-agent>
    </server-debug>
    <listen-address>localhost</listen-address>
    <network-access-point>
    *<name>synergyChannel1</name>*
    *<protocol>cluster-broadcast</protocol>*
    *<listen-address>localhost</listen-address>*
    *<listen-port>61702</listen-port>*
    <http-enabled-for-this-protocol>true</http-enabled-for-this-protocol>
    <tunneling-enabled>false</tunneling-enabled>
    *<outbound-enabled>true</outbound-enabled>*
    *<enabled>true</enabled>*
    <two-way-ssl-enabled>false</two-way-ssl-enabled>
    <client-certificate-enforced>false</client-certificate-enforced>
    </network-access-point>
    <jta-migratable-target>
    <user-preferred-server>synergyOSBServer1</user-preferred-server>
    <cluster>synergyCluster1</cluster>
    </jta-migratable-target>
    </server>
    <server>
    <name>synergyOSBServer2</name>
    <ssl>
    <enabled>false</enabled>
    </ssl>
    <machine xsi:nil="true"></machine>
    <listen-port>61703</listen-port>
    <listen-port-enabled>true</listen-port-enabled>
    <cluster>synergyCluster1</cluster>
    <web-server>
    <web-server-log>
    <number-of-files-limited>false</number-of-files-limited>
    </web-server-log>
    </web-server>
    <listen-address>rdoelapp001013</listen-address>
    <network-access-point>
    *<name>synergyChannel1</name>*
    *<protocol>cluster-broadcast</protocol>*
    *<listen-address>rdoelapp001013</listen-address>*
    *<listen-port>61702</listen-port>*
    <http-enabled-for-this-protocol>true</http-enabled-for-this-protocol>
    <tunneling-enabled>false</tunneling-enabled>
    *<outbound-enabled>true</outbound-enabled>*
    *<enabled>true</enabled>*
    <two-way-ssl-enabled>false</two-way-ssl-enabled>
    <client-certificate-enforced>false</client-certificate-enforced>
    </network-access-point>
    <java-compiler>javac</java-compiler>
    <jta-migratable-target>
    <user-preferred-server>synergyOSBServer2</user-preferred-server>
    <cluster>synergyCluster1</cluster>
    </jta-migratable-target>
    <client-cert-proxy-enabled>false</client-cert-proxy-enabled>
    </server>
    <server>
    Edited by: 818591 on Feb 18, 2011 11:26 AM

  • Osb jms query

    Hi,
    I have generic jms client code as part of my web application sits on weblogic 11g, which publishes the text message file to different jms providers based on configuration (set the file path to be published, connection factory and destination info etc). Currently it works fine with weblogic JMS and websphere mq. Now I need to test with OSB.
    So how can I use osb here? Do I need to use osb proxy service to publish the message to either weblogic JMS or MQ?
    Can I configure osb in some way so that my generic jms provider will publish the message using osb?
    Does OSB has default JMS Provider or we need to always plug in the external jms provider like mq?
    As I am new to osb it will be very helpful your inputs on this. Appreciate your inputs.
    Thanks,
    Sri.

    Hi-
    I have generic jms client code as part of my web application sits on weblogic 11g, which publishes the text message file to different jms providers  I assume you clinet posts the msg to weblogic queue
    So how can I use osb here? Do I need to use osb proxy service to publish the message to either weblogic JMS or MQ?You have configure a Business Service with JMS protocol providing the end point URL.
    refer this doc for the same http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/interopjms/transport.html
    Does OSB has default JMS Provider or we need to always plug in the external jms provider like mq?OSB supports JMS transactions
    As I am new to osb it will be very helpful your inputs on this. Appreciate your inputs. These docs could help you to explain about OSB
    http://www.oracle.com/technology/pub/articles/jumpstart_for_osb_development_page_3.html
    http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15020/toc.htm

  • Can we handle various other kind of transactions in JMS transaction?

    I know we can handle heterogenous transactions like JDBC Transactions, JMS transactions, etc from JTA.
    Can we similarly handle such various txns in JMS transactions also?
    SO say when I get a message, I need to send another message, and update some 2-3 DB instances. If any of latter 2 fails whole JMS txn should rollback.
    Is it possible in JMS?
    Please point me some online docs if available.
    Thanks in advance

    Yes it is. Use 2 Phase commit,(these are this X... Classes)
    Edited by: lieni on Jan 9, 2008 10:42 PM

  • Recovering Inactive JMS Transactions

    I'm running WL server 10.3.3 with "plain old" JMS transactions (no JTA), run from a WL JMS 'C' interface based client.
    Occasionally I see the following JMS error returned in place of a transaction timeout. I.e. this happens at the time a transaction should have timed out:
    'Attempt to resume an inactive transaction: BEA1-075EEE16749AF9834384:error resuming transacted session's internal transaction'
    Once this happens, the transaction appears to be "frozen". It cannot be committed or rolled back, since it keeps generating that same inactive transaction error. The messages associated with that transaction are "stuck" inside the application until they're committed using another session / transaction. So far, the messages read with the transaction that turns inactive don't reappear on the queue until the application exits; this means that the messages would reappear on the queue after exit, and presumably be processed a second time once the application starts again.
    Is there any way to recover/commit/rollback an inactive transaction without quitting the application that started it?
    Thanks for your help.

    I haven't tried that. However, that's a manual operation, which isn't practical to do on a customer site. I'm looking for a way to recover inactive transactions programatically.
    BTW, I found out that most of these inactive transactions are caused by the JTA transaction timeout value being set lower than the Connection Factory transaction timeout value. While that doesn't solve the problem completely, it does allow us to remove the most common source of inactive transactions by co-ordinating the timeout values.

  • OSB: JMS Transport URL for cluster

    Hi,
    I am trying to configure OSB JMS Transport business service. I have 3 JMS servers in my cluster and I am trying to understand how to configure my business service URI. Can I use all three uri's in my business service? If we configure multiple URI's how will they be used? The load balanced algorithm(round robin) we specify is for these uris?
    Thank you
    Matt

    maybe this one helps a bit :
    https://blogs.oracle.com/MarkSmith/entry/osb_and_jms_business_service_c

  • OSB JMS Proxy XA Transaction Rollback not occuring to queue

    Hi All
    We are dequeuing a message from JMS queue via an XA connection factory and then calling a web service. If any error occurs in the web service we catch the error handler, log and notify it and want to send this message back to the queue for retrial (The retry settings are defined at the Queue Level from weblogic console).
    Problem is rollback is not occurring, we have tried the below:
    1) There is no OSB reply with either success or failure in the error handler (This should have done the trick)
    2) We have also tried addiing an explicit Raise Error (Uncaught Error) to roll the message back, but its not working.
    This rollback is not occurring because JMS Resource is XA and web service call is NON XA, hence the entire message flow becomes NON XA. Is this understanding correct?
    How can we fix this? Please help

    Hi atheek1
    Thanks for the reply, it worked. Before I mark this question as answered, pls. answer the below queries (Thanks a lot!)
    1) Well, i just ticked transaction required and same transaction for response and it started working. I did not add routing options like you mentioned to QOS Exactly Once. Its working without it fine. So, my questions is what is the use of adding this QOS to exactly once. Is it mandatory?
    2) I have a couple of OSB services in which rollback is working automatically (XA JMS to JCA FTP Adapter) and (XA JMS to JCA DB adapter XA data source), here rollback works automatically. I dont have to tick transaction required. So my question is, when an XA based connection factory picks a message from the queue, a transaction is started at the container level. So why tick transaction required at the message flow level, when the weblogic has already initiated a transaction. Since you said that HTTP transport commits a transaction even if 500 or 404 occurs, it makes sense to tick is transaction required and same transaction for response in OSB proxy service. But the remaining scenarios work without these options. Hence will it be wise to say that these settings are only required for HTTP transport coz of the way it behaves (commits 404 and 500).
    Thanks

  • Osb 11g transaction handling

    Hi,
    I have a problem with transaction handling in OSB 11g. When I add a report action, error messages disappear.
    The process is the following:
    jms-queue -> proxy-service ->business-service ->EBS webservice.
    In the proxy-service I add an error-handler at node-level. In this error-handler I log the error-message in the server log. In the regular process there is a request and response-pipeline.
    When I add a message on the queue and when the response from EBS is negative, the message is placed on a errorqueue. That's ok.
    When I add a report-action to the error-handler and then I put another message on the queue, the message is disappeared. It is not on the error-queue and not on the normal queue. When I look in the database there is an extra row added.
    I use the default datasource(wlsbjmsrpDataSource).
    I found for example this blog: http://biemond.blogspot.nl/2010/11/global-transactions-and-quality-of.html ; but I can't find an example with writing to a database and a rollback to an errorqueue. The report-action needs it's own transaction.
    In the weblogic console -> datasources -> transaction I unchecked "Keep Connection After Local Transaction" but that didn't work.
    What kind of options is possible?
    Herman

    I cant believe i was answered by the famous Anuj!.
    You were correct. The weird thing, is that in publish actions the QoS is not propagated onto the target of that Publish per se.
    We say this, becouse the Local PS has the Transaction Required = True, ergo the QoS is Exactly Once all along its message flow. It also propagates in the service callout´s and Route Node´s. Thats why we, trying to avoid redundance, didnt specified it in the publish action.
    Thank you very much.
    Regards.
    Mario.

  • JMS (Transaction ???) problem, consumer receives all messages at once.

    Hallo, I have an application which implements asynch communication between the web and business layer using JMS.
    On a page a user can upload files, which are processed by the backend. For large files this can be a long running process, thats why we use JMS to send the file asynchronously and use JMS to update progress information on the page.
    The application works fine on JBoss 6 with HornetMQ.
    After porting to Weblogic I see consistently a strange phenomenon. The update messages from the processing backend logic are send as expected. But the receiver does not receive one message after another but receives all the messsages almost at once after only the producer has sent the last message.
    For me this is totally unexpected behavior and of course our progress bar on the page does not work properly, but merely jumps from 0 to 100% after the data has been processed.
    It looks like the consumer waits until the producer has finished its transaction. But how can this be possibly? I have learned that transaction never span producer - messagesystem - consumer.
    Example Code:
    Producer:
    import javax.annotation.PostConstruct;
    import javax.annotation.PreDestroy;
    import javax.annotation.Resource;
    import javax.ejb.EJB;
    import javax.ejb.Stateless;
    import javax.interceptor.Interceptors;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.DeliveryMode;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.MessageProducer;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import org.apache.log4j.Logger;
    import com.sun.tools.ws.wsdl.document.jaxws.Exception;
    import dsde.core.aspects.DsdeException;
    import dsde.core.aspects.ExceptionHandler;
    import dsde.core.entity.Data;
    @Stateless
    @Interceptors(ExceptionHandler.class)
    public class ParserBean implements Parser {
         private Logger log = Logger.getLogger(this.getClass());
         @EJB
         private DataDAO dataDAO;
         //Weblogic
         @Resource(mappedName="jms.BackQueue")
         //Jboss
         //@Resource(mappedName="queue/dsdeBackQueue")
         private Destination backQueue;
         //Weblogic
         @Resource(mappedName="jms.dsdeConnectionFactory")
         //JBoss
         //@Resource(mappedName="XAConnectionFactory")
         private ConnectionFactory connectionFactory;
         private Connection connection;
         @Override
         public void parse(String text, String description, String sessionId) throws DsdeException{
              double percentDone = 0;
              double j = 0.0;
              //Simuliere was langdauerndes, schwieriges
              for (int i=0; i < text.length(); i++) {
                   j = i;
                   percentDone = j / text.length() * 100;
                   try {
                        Thread.sleep(1000);
                   } catch (InterruptedException e) {
                        log.error(e);
                   if (i % 2 == 0) {
                        //periodisch das Frontend mit dem Fortschritt updaten
                        sendFeedback((int)percentDone, sessionId);
              //Zum Schluss noch senden dass wir fertig sind
              //Sonst wird der Send Button nicht wieder aktiv
              percentDone=100;
              sendFeedback((int)percentDone, sessionId);
              //Jetzt wird noch richtig geparsed :-)
              String[] words = text.split(" ");
              //Entity konstruieren
              Data data = new Data(description, words);
              //Das Ergebnis in die Datenbank schreiben
              dataDAO.saveData(data);
         private void sendFeedback(int percentDone, String sessionId) {
              Session session = null;
              try {
                   session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                   MessageProducer producer = session.createProducer(backQueue);
                   producer.setTimeToLive(50000);
                   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                   TextMessage message = session.createTextMessage();
                   message.setJMSCorrelationID(sessionId);
                   message.setText("" + percentDone);
                   producer.send(message);
                   log.info("ParserBean has sent " + percentDone);
              } catch (JMSException e) {
                   log.error(e);
              } finally {
                   if (session != null) {
                        try {
                             session.close();
                        } catch (JMSException e) {
                             log.error(e);
         @PostConstruct
         public void init(){
              try {
                   connection = connectionFactory.createConnection();
              } catch (JMSException e) {
                   log.error(e);
         @PreDestroy
         public void close() {
              try {
                   connection.close();
              } catch (JMSException e) {
                   log.error(e);
    }Consumer:
    import javax.annotation.ManagedBean;
    import javax.annotation.PostConstruct;
    import javax.annotation.PreDestroy;
    import javax.faces.bean.SessionScoped;
    import javax.faces.context.FacesContext;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageConsumer;
    import javax.jms.MessageListener;
    import javax.jms.Queue;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.http.HttpSession;
    import org.apache.log4j.Logger;
    @ManagedBean
    @SessionScoped
    public class FeedbackReceiverBean implements MessageListener {
         private Logger log = Logger.getLogger(this.getClass());
         //jndi names of managed objects
         private String connectionFactoryName;
         private String queueName;
         private Connection connection;
         private Session session;
         private int percent;
         private boolean disabled;
         public boolean isDisabled() {
              return disabled;
         public void setDisabled(boolean disabled) {
              this.disabled = disabled;
         public int getPercent() {
              return percent;
         public void setPercent(int percent) {
              this.percent = percent;
         public void setConnectionFactoryName(String connectionFactoryName) {
              this.connectionFactoryName = connectionFactoryName;
         public void setQueueName(String queueName) {
              this.queueName = queueName;
         @PostConstruct
         public void init() throws NamingException, JMSException {
              FacesContext facesContext = FacesContext.getCurrentInstance();
              HttpSession httpSession = (HttpSession) facesContext.getExternalContext().getSession(false);
              String sessionId = httpSession.getId();
              Context context = new InitialContext();
              ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(this.connectionFactoryName);
              Queue queue = (Queue) context.lookup(this.queueName);
              this.connection = connectionFactory.createConnection();
              this.session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
              String filter = "JMSCorrelationID = '" + sessionId + "'";
              MessageConsumer consumer = session.createConsumer(queue, filter);
              consumer.setMessageListener(this);
              connection.start();
         @PreDestroy
         public void close() throws JMSException {
              this.session.close();
              this.connection.close();
         @Override
         public void onMessage(Message message) {
              if (message instanceof TextMessage) {
                   TextMessage textMessage = (TextMessage) message;
                   try {
                        this.percent = Integer.parseInt(textMessage.getText());
                        if (percent >= 100) {
                             this.disabled = false;
                        log.info("Prozent " + percent);
                   } catch (JMSException e) {
                        log.error(e);
              else {
                   log.error(message.toString() + " is no TextMessage");
         public void disable() {
              this.disabled = true;
    }Configuration:
    <?xml version='1.0' encoding='UTF-8'?>
    <weblogic-jms xmlns="http://xmlns.oracle.com/weblogic/weblogic-jms" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-jms http://xmlns.oracle.com/weblogic/weblogic-jms/1.1/weblogic-jms.xsd">
      <connection-factory name="dsdeConnectionFcatory">
        <default-targeting-enabled>true</default-targeting-enabled>
        <jndi-name>jms/dsdeConnectionFactory</jndi-name>
        <default-delivery-params>
          <default-delivery-mode>Persistent</default-delivery-mode>
          <default-time-to-deliver>0</default-time-to-deliver>
          <default-time-to-live>100</default-time-to-live>
          <default-priority>4</default-priority>
          <default-redelivery-delay>0</default-redelivery-delay>
          <send-timeout>10</send-timeout>
          <default-compression-threshold>2147483647</default-compression-threshold>
        </default-delivery-params>
        <client-params>
          <client-id-policy>Restricted</client-id-policy>
          <subscription-sharing-policy>Exclusive</subscription-sharing-policy>
          <messages-maximum>10</messages-maximum>
        </client-params>
        <transaction-params>
          <xa-connection-factory-enabled>true</xa-connection-factory-enabled>
        </transaction-params>
        <security-params>
          <attach-jmsx-user-id>false</attach-jmsx-user-id>
        </security-params>
      </connection-factory>
      <queue name="dsdeQueue">
        <sub-deployment-name>dsdeQueue</sub-deployment-name>
        <jndi-name>jms/dsdeQueue</jndi-name>
      </queue>
      <queue name="dsdeFeedbackQueue">
        <sub-deployment-name>dsdeFeedbackQueue</sub-deployment-name>
        <jndi-name>jms/dsdeFeedbackQueue</jndi-name>
      </queue>
      <queue name="dsdeBackQueue">
        <sub-deployment-name>dsdeBackQueue</sub-deployment-name>
        <jndi-name>jms/BackQueue</jndi-name>
      </queue>
    </weblogic-jms>Any help would be greatly appreciated.
    Thanks,
    Hans

    Thanks for posting your analysis!
    I think your solution is probably best.
    FYI: Your JMS session was never a "transacted" session. It's definitely confusing, but the term "transacted session" has a special meaning in JMS, it actually refers to a session that is not XA/JTA aware and instead maintains an internal local transaction that's scoped only to the current JMS session's operations. A transacted session is created by passing "true" to the first parameter of createSession, and such a session's local transaction is committed by calling session.commit() (which starts a new transaction). To further add to the confusion, I think that JEE servers are actually obligated to ignore requests to set the transacted flag to true -- WebLogic does this trick by secretly wrapping access to the JMS API when applications lookup JMS connection factories via a resource reference.
    Regards,
    Tom

  • OSB JMS Consumer

    Hi Friends,
    I have a requirement where I need to develop a OSB service which will:
    1. Poll Message from JMS (A specific schema element)
    2. Write this message to DB using routing (JCA adapter, send schema as is to business service)
    I am able to poll JMS message in OSB, however while routing it to business service that will write to DB using JCA adapter I am facing following error.
    OSB Replace action failed updating variable "body": Error parsing XML: {err}FORG0005: expected exactly one item, got 0 items
    Although I can print the JMS message by "$body/." meaning I have an element.
    Could you please shade some light on this?
    Thanks,
    Sachin

    Are you mediator for schema transformation? This error is faced mostly when source request schema fails to map destination schema (DB interface).

  • Distributed JDBC/JMS transaction commit order

    I am using WLS 10.3.0. I have an app with container-managed EJBs which participate in distributed transactions using XA drivers for two resources, (1) a jdbc connection to Oracle database, and (2) WebLogic JMS server. In a typical EJB call, I am writing a record to the database and sending a message to a local queue which is being consumed by a MDB. My question is how can I guarantee that by the time the MDB receives the JMS message, the record will be guaranteed to have been committed in the database. It appears that occasionally the record is not yet there. Is there a way to force the jdbc commit to happen before the JMS message gets consumed? I know there is a commit_point_strength parameter that determines commit order for the database resource, but I don't see such a concept for JMS...

    "The Default Time-to-Deliver attribute for XAConnectionFactory for the Weblogic JMS connection queue, is a minimum interval from when the message is SENT, to when it is available to be processed. What is really needed is a delay from COMMIT time -- not from the sent time."
    <jay>
    Not entirely true. Delay is not from when message is “SENT, Default Time-To-Deliver is delay at within JMS subsystem before it delivers message to consumer. It means that "Send" thread will not block for this delay and "Send" side executes no different whether there is "Time-to-Deliver" configured or not.
    </jay>
    "For example, imagine a distributed transaction does a JMS send, followed by a query that takes 10 seconds, followed by a commit. If Default Time-to-Deliver is set to 5 seconds, it will be completly ignored, since the 10 seconds from the send to the commit is a larger interval. So at commit it is still very possible that the MDB will receive the message before the database transaction is committed."
    <jay>
    This is not true also. JMS message will be available for delivery only after distributed transaction commits and more specifically "commit" part of the JMS resource completes - clock for "message delivery delay" will not start until distributed transaction is committed. Considering transaction will not commit until slow running query completes execution above scenario will not cause “Default Time-to-Deliver” workaround to fail.
    Slow execution of the XA.commit() request from TM (Weblogic) to database may cause concern , however considering that TM (WebLogic) receive response of the XA.prepare() from all participating resources before XA.commit(), commit should execute with delay not more than few milliseconds and chances are negligible that proposed workaround will fail.
    </jay>
    "The bottom line, is that this parameter is not an effective way to control the race condition unless the JMS send is always performed as the last action in a distributed transaction.
    For this reason we have gone with inserting a small configurable sleep at the start of the onMessage() methods in the MDB. Not a very elegant solution, but the one ne that works reliably."
    <jay>
    I think "Default Time-to-Deliver" is no less effective or no less reliable solution than placing sleep() in onMessage(), however it is more cleaner solution because it uses application server built in feature instead of updating code in onMessage().
    </jay>
    -jayesh@yagna

  • [OSB]JMS Business Service sending message with a given JMSCorrelationID

    Hi,
    Is it possible to send jms message with a given JMSCorrelationID in OSB? Just like use javax.jms.Message.setJMSCorrelationID() before sending.
    If yes, how to change the payload accordingly?
    Any help? Thanks in advance.

    Try Transport Headers action in request action route node (Add Action >> Communication >> Transport Headers).
    Then click on add headers and in name drop down select the JMSCorrelationID. In set Headers to expression select the value you want to put for JMSCorrelationID.

  • JMS transaction rollback from Javacallout

    Hi,
    I have a proxy which insert message into queue via business service, and i have another proxy which pull message from queue and call to javacallout which returns boolean (true/false). During some processing javacallout return a boolean false. I have managed for checking if the boolean returned in false then i want to rollback the transaction and message to put back to queue.
    I have setting "Is XA required = true" and JMS proxy configured for XA connection.
    When i recieve boolean false from javacallout i am raising error which is not handled by any error handler. I dont have stage error handler, no service error handler and hence according to me error should propegate and it should rollback.
    But message is not rollback to queue.
    I have "Redelivery Delay Override", "Redlivery Limit" property set to -1 (default) and "Expiration Policy" set to "Discard" and no "Error Destination" selected for Queue setup.
    I am using Oracle Service Bus 10gR3 version.
    I am new to this type of configuration and i suppose i am missing some configuration here.
    Please help me, its little urgent.
    Thanks
    Sujit

    Hi Sujit,
    I have "Redelivery Delay Override", "Redlivery Limit" property set to -1 (default) and "Expiration Policy" set to "Discard" and no "Error Destination" selected for Queue setup.
    Change the Redelivery Limit field  to 3 ( specify the number of redelivery tries a message can have before it is moved to an error destination  like three times)
    Select Redirect as Expiration Policy.
    Select ErrorQueue ( Queue where you wants the rollback message should enqueue) as the Error Destination value.
    make sure to use XA connection factory.
    Hope it helps ..
    Regards,
    Abhinav Gupta

  • OSB JMS Transport configuration

    I have a need to pass a reply-to destination from one external process (the producer) to a second external process (the consumer), with the design supporting flexibility for changing destinations within the OSB pipeline at a future time. To enable this functionality, the following jms transport was designed on the OSB 10gR3:
    external producer--->|---q1--->jmsTransProxy---->q2---|--->external consumer
    The jmsTransProxy is configured with request/response text message types, jms protocol, Get All Headers yes, Is Response Required enabled, and Response Correlation Pattern CorrelationID.
    In the Request pipeline of jmsTransProxy, a single stage is configured to Pass All Headers through Pipeline.
    In the Response pipeline of jmsTransProxy, a single stage is configured to Pass All Headers through Pipeline.
    When the external producer sets the JMSReplyTo header, I expected that this header would be passed from q1 to q2 so that the external consumer would receive it. The message payload is correctly received by the external consumer along with the JMSCorrelationID, but not the JMSReplyTo header information. By examining the logs, I can see the header information is received correctly in the request pipeline, but is not available from q2.
    What is the correct solution to have the JMSReplyTo information pass through to the external consumer?

    Thank-you for your tips.
    I have revised the pipeline as you indicated and more of the headers pass through, but not the JMSReplyTo header. Because the user headers are passed through, I can use get/setObjectProperty on the message to realize the functionality required (though this is a workaround).
    current configuration:
    external producer--->q1--->jmsProxy--->jmsBusiness--->q2---> external consumer
    jmsProxy parameters:
    service type: messaging service
    request message type: text
    response message type: none
    protocol: jms
    endpoint uri: q1
    get all headers: yes
    destination type: queue
    is reposnse required: disabled
    etc.
    jmsProxy request pipeline:
    publish to [ jmsBusiness ]
    request actions: set transport headers for [ outbound request ] (pass all headers)
    jmsBusiness parameters:
    service type: messaging service
    request message type: text
    response message type: none
    protocol: jms
    endpoint uri: q2
    destination type: queue
    is reposnse required: disabled
    etc.

  • OSB JMS resources in a cluster

    Hi,
    I am creating an OSB cluster with multiple managed servers using a script. I would like to know what resources (JMS) are needed and how they should be targeted so that reporting works.
    Best regards
    Dimo

    I think I have found out what is required by the OSB:
    1. DataSource deployed in the cluster AND on the admin server for the reporting (wlsbjmsrpDataSource), scripts to drop and create the tables are located in ${osb_home}/dbscripts/oracle/
    2. JMS Module containing:
    2.1. 3 Connection factories:weblogic.wlsb.jms.transporttask.QueueConnectionFactory, wli.reporting.jmsprovider.XAConnectionFactory, wli.reporting.jmsprovider.NonXAConnectionFactory
    2.2. 8 Queues - QueueIn, wli.reporting.jmsprovider.queue, wli.reporting.jmsprovider_error.queue, wli.reporting.purge.queue, wlsb.internal.transport.task.queue.email, wlsb.internal.transport.task.queue.file, wlsb.internal.transport.task.queue.ftp, wlsb.internal.transport.task.queue.sftp
    I am not sure if that list is complete as it has been a bit of reverse engineering to find it out...

Maybe you are looking for

  • Crystal Report: ERROR - Some parameters are missing values

              mine report it possesses a single parameter ....           this is the example of like tries of to change the value set up in the report...           ERROR: Some parameters are missing values           thanks help...           EXAMPLE:     

  • "SYST: Period 012 is not valid in financial year variant Z4"

    Hi Iam getting this error  "SYST: Period 012 is not valid in financial year variant Z4" in Asset accounting  when using the shortend fiscal yr with 9 periods in 2010. Generated the period control OA84 for this variant Z4  but still getting the error.

  • Dispute Case

    Hi All, I have gone through SAP traning for FSCM Credits, Collections and Dispute mgt. I have few basic questions. Could someone please answer these- 1. Dispute case can be initaited by anyone - either Customer or User/authorized employee of the orga

  • Camera connection kit issue

    Hi, Currently I have 2 iPads and after I upgraded one of them to iOS 7 the camera connection kit is recognized into the About section in general section.. But nothing happens on Photo app when I plug it in. In the other iPad with IOS 6 the camera con

  • "Unexpected Quit" dialog from OS upon actually quitting Safari.

    This occurs only when having accessed a PDF file during the Safari session. And occasionally during the access of a PDF file. This is a new behavior, concurrent upon updating to OS 10.4.11. And I tried replacing the new 3.0.4 Safari with the prior ve