JMS transaction between two queues

Hi there,
          I have been asked to build some code that will act as an adapter
          between two legacy systems. Basically I will have to read from a
          queue, transform the information and write it to the other, then
          receive the response, transform it, and put it again back to the
          "caller" system.
          There are 4 queues implicated in this task.
          I will to use JMS Api in my code but I have found a problem. The way
          of performing a transaction in JMS is this:
          QueueSession queueSession = queueConnection.createQueueSession(true,
          0);
          "Here, the first argument means that the session is transacted; the
          second indicates that message acknowledgment is not specified for
          transacted sessions."
          As queueConnection is a connection to ONE queue, I can only perform
          transactions to ONE queue! But I don´t want to consume a message till
          I know it has been sent correctly to the other side.
          I have also read that some JMS providers support JTA transactions.
          But I don´t know if this is the right way to go.
          Can anybody bring some light to this issue.
          Thaks al lot for your attention!!
          

          This post has blossomed into several threads. I'm going to
          attempt a shot-gun approach to answer all questions.
          On MQSeries:
          See "How to use IBM MQ as a JMS Provider?" posts for more info.
          On transacted sessions:
          If this is ALL MQSeries, then it is up to MQSeries if a transacted
          session can span multiple queues and/or servers. WL supports this.
          MQSeries may simply prevent a session from
          spanning multiple servers and/or queues. Note that other vendors,
          that do not have their own TX monitor, very very likely do
          not have a 2PC in a transacted session that spans multiple servers
          (meaning it is not truly transactional).
          On JTA and multiple queues:
          The whole reason for being for JTA is to be able to span multiple
          operations. Yes, this is supported in WL.
          On the manuals:
          These issues are covered in great detail in the WL JMS developer's
          guide in the transactions chapter.
          On bridging:
          You do not have to write your own bridge.
          WL supplies a bridge to greatly simplify the work involved.
          WL 7.0 can even bridge two XA compliant JMS implementations transactionally.
          (Neither has to be WL JMS.) WL 6.1SP3 will have this same feature, now
          avialable as alpha code in 6.1. See "How to use IBM MQ as a JMS Provider?" posts for more
          info.
          On queuing and transactions:
          One can not include a request and its response in the same transaction. Period.
          This is the nature of queueing. One can dequeue from one queue and
          enqueue to another. I think you understand this, but it bears repeating.
          Tom
          Mac wrote:
          > I know that a recieve will not remove a message and a send will not
          > send it until the transaction is commited.
          >
          > In fact I want to do 2 transactions one for each receive-send.
          >
          > graphic again! ;)
          >
          > queue1 queue3
          > ======> =====>
          > legacy 1 Java Adapter legacy 2
          > queue2 queue4
          > <====== <=====
          >
          > In the period of time between reading from queue1 and writing to
          > queue3 the adapter could fail thus a message will be lost. The same
          > happens with queue4 and 2. Maybe this could be solved with a
          > transaction over queue1 and another one over queue4, but I'm not sure.
          >
          > I will have to decide if I use JMS or MQSeries API. MQ allows you to
          > wrap more than one queue in the same transaction if they are in the
          > same Queue Manager. So I wanted to know if JMS also allows to make a
          > transation over more than one queue and how is it done. only JTA?
          > QueueSession? impossible?
          >
          > tnx really for your help!
          >
          > "Raja Mukherjee" <[email protected]> wrote in message news:<[email protected]>...
          > > You can not. Even if you could, it's at least have to be 2 transactions.
          > > Because, if all of your work is in one transaction you will never send or
          > > receive messages, you would be blocking for ever. In order to send the
          > > message you will have to commit the transaction on the first place.
          > >
          > > .raja
          > >
          > > "Mac" <[email protected]> wrote in message
          > > news:[email protected]...
          > > > Sorry Tom, I think that I have not explained well my problem.
          > > >
          > > > The following extrange symbols are supposed to be an explaining
          > > > graphic!! ;)
          > > >
          > > >
          > > > queue1 queue3
          > > > ======> =====>
          > > > legacy 1 Java Adapter legacy 2
          > > > queue2 queue4
          > > > <====== <=====
          > > >
          > > > Legacy System 1 wants to call a service of legacy system 2, but they
          > > > can not communicate directly so we will use MQ Series as both them
          > > > support it.
          > > > For that purpose Legacy1 puts a message in queue1. The Java Adapter
          > > > transforms the message and puts it in queue3. Legacy2 processes the
          > > > request and replies with a message in queue4. The Java Adapter gets
          > > > it, transforms it and puts it in queue2. As a result legacy1 obtains
          > > > the information it was asking for.
          > > >
          > > > I'm using MQ Series 5.2 as middleware. I will not use Message Driven
          > > > Beans so I won´t have an EJB container to perform distributed
          > > > transactions.
          > > >
          > > > The question is: How can I put and get messages in the 4 queues
          > > > using de same transaction?? Can I do it somehow with JMS session or I
          > > > must use a JTA transaction?
          > > >
          > > > Thanks again for your help, and forgive me for being so insistent!
          > > > :)
          [att1.html]
          

Similar Messages

  • How to perform a WS-transaction between two webservices implemented in EJB3

    Hello,
    I would like to have an example of how to perform a WS-Transaction between two web services implemented with EJB 3.0. It should be done through code.
    Thanks in advance.

    Bit a late answer, btu I don't like googling for somthing and founding open questions about the topic I search for.
    Have a look at
    http://jbossws.jboss.org/mediawiki/index.php?title=JAX-WS_User_Guide
    and
    http://soa.sys-con.com/node/39769
    Cheers

  • Issues with JMS messaging between two Glassfish Domains

    All -
    I have a stand alone client and two Glassfish Domains - each of which has a message bean on it. I have successfully sent messages from the client to each message bean, however, I then want the message beans to be able to send messages back and forth from one another. This is where I run into a problem. For some reason, I am getting errors when trying to send a message from one message bean on Domain1 to another message bean on Domain2. Is this possible to do? Can someone help out with the exception that I am getting below?
    Thanks in advance....
    package mdbs;
    import java.util.Hashtable;
    import java.util.Iterator;
    import java.util.Map;
    import java.util.Set;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.JMSException;
    import javax.jms.MapMessage;
    import javax.jms.MessageProducer;
    import javax.jms.Queue;
    import javax.jms.Session;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    * @author frostry
    public class SendMessage {
        Context ctx;
        Boolean sendMessage(String connFactory, String destResource, String providerURL, Map message) {
            Connection connection = null;
            Session session = null;
            try{
                context(providerURL);
                ConnectionFactory connectionFactory = (ConnectionFactory) lookup("jms/tankConnectionFactory");  // connFactory
                Queue queue = (Queue) lookup(“jms/tankQueue”);   // destResource
                System.out.println("QueueName = "+queue.getQueueName());
                connection = connectionFactory.createConnection();
                session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
                MessageProducer messageProducer = session.createProducer(queue);
                MapMessage mapMsg = session.createMapMessage();
                    //TextMessage message = session.createTextMessage("It is a message from main class "+  ": "+ i);
                    Set keys = message.keySet();
                    Iterator i = keys.iterator();
                    while (i.hasNext()) {
                        String key = (String) i.next();
                        String val = (String) message.get(key);
                        mapMsg.setString(key, val);
                    System.out.println( "Message Is:"+ mapMsg.toString());
                    messageProducer.send(mapMsg);
            } catch(JMSException e) {
                e.printStackTrace();
            } catch(Exception ex){
                ex.printStackTrace();
            return true;
        public void context(String providerURL) {
            Hashtable properties = new Hashtable(2);
            properties.put(Context.PROVIDER_URL,"iiop://127.0.0.1:1481");   // providerURL
            properties.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
            try {
                ctx = new InitialContext(properties);
            } catch (NamingException ex) {
                ex.printStackTrace();
       public Object lookup(String name){
            try {
                System.out.println("About to lookup dest resource = "+name);
                return ctx.lookup(name);
            } catch (NamingException ex) {
                ex.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            return null;
    from domain.xml on Domain2 - the IIOP port is 1481:
    <iiop-service client-authentication-required="false">
    <orb max-connections="1024" message-fragment-size="1024" use-thread-pool-ids="thread-pool-1"/>
    <iiop-listener address="0.0.0.0" enabled="true" id="orb-listener-1" port="1481" security-enabled="false"/>
    The output I get is:
    A Message received by TankBean: MessageTitle = start
    list[i] ==> 127.0.0.1:1481
    corbaloc url ==> iiop:[email protected]:1481
    QueueName = PhysicalQueue
    java.lang.NullPointerException
    at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:248)
    at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:176)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:337)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:189)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:158)
    at com.sun.messaging.jms.ra.DirectConnectionFactory._allocateConnection(DirectConnectionFactory.java:569)
    at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:262)
    at com.sun.messaging.jms.ra.DirectConnectionFactory.createConnection(DirectConnectionFactory.java:241)
    at mdbs.SendMessage.sendMessage(SendMessage.java:43)
    at mdbs.TankBean.FireMissile(TankBean.java:138)
    at mdbs.TankBean.startTank(TankBean.java:88)
    at mdbs.TankBean.onMessage(TankBean.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011)
    at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175)
    at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2920)
    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4011)
    at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1111)
    at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:74)
    at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:179)
    at $Proxy124.onMessage(Unknown Source)
    at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:258)
    at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

    I don't have any ground-breaking news for you, just wanted to say that you're correct - you sure can send messages from one server instance to another.
    I've never worked with GlassFish, but JMS is JMS and exchanging messages in the way you described should work just fine.
    Let me just make sure about the obvious:
    Example: instance A, port 1099, queue qA; instance B, port 2000, queue qB
    To send message from A to B you create InitialContext for server B (port 2000), lookup queue qB and put a message on it.
    To send message from B to A you create InitialContext for server A (port 1099), lookup queue qA and put a message on it.
    I'm sure you're doing this, though.
    You can use this code to print the content of JNDI tree:
         public void printList(NamingEnumeration<NameClassPair> list) {
              NameClassPair entry;
              System.out.println("JNDI tree:");
              while (list.hasMoreElements()) {
                   entry = list.nextElement();
                   System.out.println("name=", entry.getName(), ", class=", entry
                             .getClassName());
    You call it like this: printList(initiaiContext.lookup("/"));
    You can replace "/" with the path you want to list. In your case "/jms" could be more useful.
    With this method you can see if all your objects (connection factories, queues, whatnot) are bound where they should be.
    If all is there things should work - just keep digging.
    HTH,
    Mark

  • STO clearing account between two company codes

    Hi, every body, when trying to do STO between two company codes, I am getting error to configure the *clearing account between that two company codes, please guide me in resolving the issue, if anybody gives me perfect step by step explanation regading this issue, I will surly reward them with highest points

    Hi Azeem,
    When there is a transaction between two company codes, then you need to define the clearing accounts for those two company codes in the TCode: OBYA.
    It will ask for Company code 1 and Company code 2.  there you give your 2 company codes and define the posting keys and clearing GL accounts over there.
    I think your problem will be solved with this.  Please let me know the status and please reward points if found useful.
    Regards,
    Sreekanth....

  • Weblogic JMS bridge between Weblogic and oracle Advanced Queue

    Hi,
    We are facing some issues when we are trying to integrate with Oracle AQ JMS through Weblogic.
    We have configured a Foreign AQ server which points to the oracle Advanced Queue and we are trying to create a Weblogic JMS bridge between AQ and weblogic. The bridge works perfectly if create the connection factories and bridge destinations with NonTX mode. The issue is with XA mode. Also we have deployed the Resource adaper for XAResource to use XA transactions.
    No help is available for the exception on google too :)
    Following is the exception we are getting.
    <An error occurred in bridge "aqjmsbridge" during the transfer of messages (javax.resource.ResourceException: Failed to setup the Resource Adapter Connection for enlistment in the transaction, Pool = 'eis/jms/WLSConnectionFactoryJNDIXA', javax.transaction.SystemException: start() failed on resource 'eis/jms/WLSConnectionFactoryJNDIXA': XA_OK
    javax.transaction.xa.XAException: method start should not be called on weblogic.transaction.internal.IgnoreXAResource
    at weblogic.jms.foreign.IgnoreXAResourceImpl.start(ForeignAQIntegration.java:260)
    at weblogic.connector.security.layer.AdapterLayer.start(AdapterLayer.java:513)
    at weblogic.connector.transaction.outbound.XAWrapper.start(XAWrapper.java:466)
    at weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1184)
    at weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1117)
    at weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:275)
    at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:516)
    at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:443)
    at weblogic.connector.transaction.outbound.XATxConnectionHandler.enListResource(XATxConnectionHandler.java:118)
    at weblogic.connector.outbound.ConnectionWrapper.invoke(ConnectionWrapper.java:218)
    at $Proxy59.receive(Unknown Source)
    at weblogic.jms.bridge.internal.MessagingBridge.processMessages(MessagingBridge.java:1427)
    at weblogic.jms.bridge.internal.MessagingBridge.beginForwarding(MessagingBridge.java:1002)
    at weblogic.jms.bridge.internal.MessagingBridge.run(MessagingBridge.java:1079)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    .).>
    Will appriciate any help for the above.
    Thanks and Regards,
    Navin

    Maybe this if of any help:
    - Re: Help with creating AQ JMS
    or
    - Re: AQ Weblogic integration - JMS-107: Operation not allowed on Connection

  • How to control transactions (WS-AT) between two web services in OSB?

    Could someone tell me if the OSB can have 2 diferents web services controlled by an unique transaction?
    For instance: in the OSB there are two wsdl, each one with its own Business Service and ProxyService respectively. In my vb.net aplication I started a transaction, called the first web service succefully and from the second web service I got an exception. I expected the first web service undo its work because the vb.net aplication excute a rollback command. Is this possible? How can I do? Any sample or tip will be helpfull.
    If I was developing without OSB, I would rely on WS-AT as shown in http://www.codeproject.com/Articles/38793/6-Steps-to-Enable-Transactions-in-WCF for two web services dot net, or for one web service dot net and other java, http://www.ibm.com/developerworks/websphere/library/techarticles/0707_lo/0707_lo.html.
    My question is basically: Is still possible to keep a single transaction between multiple web services when they are mediated by OSB? If so, is there a example showing how?

    Hi,
    When you create the proxy server, you have to check "Transaction required" box on Message Handling page...
    http://docs.oracle.com/cd/E17904_01/doc.1111/e15867/proxy_services.htm#i1316487
    Cheers,
    Vlad

  • Propagation between two type raw  queues

    Good day.
    I want to enable propagation between two type raw queues -
    according to documentation:
    http://www.stanford.edu/dept/itss/docs/oracle/10gR2/server.102/b14257/aq_intro.htm#CHDCEFBD -
    "+Propagation of Messages with LOBs+
    +Large Objects can be propagated using Oracle Streams AQ using two methods:+
    +* Propagation from RAW queues+
    +* Propagation from object queues with LOB attributes+"
    My example:
    begin
    DBMS_AQADM.create_queue_table(queue_table => 'SRC1_QT',queue_payload_type => 'RAW',multiple_consumers => true);
    end;
    begin
    DBMS_AQADM.create_queue(queue_name => 'SRC1_Q',queue_table => 'SRC1_QT');
    end;
    begin
    DBMS_AQADM.create_queue(queue_name => 'DST1_Q',queue_table => 'SRC1_QT');
    end;
    begin
    DBMS_AQADM.start_queue(queue_name => 'SRC1_Q');
    end;
    begin
    DBMS_AQADM.start_queue(queue_name => 'DST1_Q');
    end;
    declare
    c number;
    begin
    dbms_aqadm.verify_queue_types(src_queue_name => 'SRC1_Q',dest_queue_name => 'DST1_Q',rc => c);
    dbms_output.put_line(c);
    end;
    Last PL/SQL block returns
    VQT: new style queue
    +0+
    Does it means that queues incompatible?

    Yes, it works - and I think dbms_aqadm.verify_queue_types shows wrong answer:
    DECLARE
    subscriber sys.aq$_agent;
    BEGIN
    subscriber := sys.aq$_agent('SRC1_SUBS', 'DST1_Q', NULL);
    DBMS_AQADM.ADD_SUBSCRIBER(queue_name => 'SRC1_Q',
    subscriber => subscriber);
    END;
    begin
    dbms_aqadm.schedule_propagation(queue_name => 'SRC1_Q');
    end;
    DECLARE
    enqueue_options     dbms_aq.enqueue_options_t;
    message_properties  dbms_aq.message_properties_t;
    message_handle      RAW(16);
    message             RAW(10000);
    BEGIN
    for i in 1..100 loop
    message :=  utl_raw.cast_to_raw(to_char(i));
    dbms_aq.enqueue(queue_name => 'SRC1_Q',
    enqueue_options      => enqueue_options,
    message_properties   => message_properties,
    payload              => message,
    msgid                => message_handle);
    end loop;
    COMMIT;
    END;
    select QUEUE,MSG_STATE,COUNT(*) from AQ$SRC1_QT T group by QUEUE,MSG_STATE
    QUEUE      MSG_STATE      COUNT(*)
    DST1_Q     READY           100
    SRC1_Q     PROCESSED       100
    Edited by: i.k. on 10.05.2011 10:49
    Edited by: i.k. on 10.05.2011 10:50

  • Transaction to see common data between two tables

    Is there any transaction to see common data between two tables with out creating views.
    what is the transaction to see the link between two tables
    regards
    pavan

    Hi,
            Go to a transparent table for which you want to know the common fields, from there click the button GRAPHICS (shortcut Ctrl + Shift + F11) in the application tool bar. Then you are redirected to a list containing the tables belonging to the same group. There select whatever tables you would like to see and click COPY. A window will pop-up and will show the relationship between the fields of the tables in a flow chart format.
    see to this link also.
    Common fields b/w  tables
    Regards,
    Revathi Bhoopal.

  • 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

  • How to calculate the month difference between two date char. in Query?

    Customers would like to see how many months passed between two date type of characteristics (e.g., the month difference between the current date and the scheduled delivery date in the record) and put the result into the column as KF. 
    We would have to grab the fiscal year/period kind of value and then do the subtraction, e.g., if the current date value is 2/28/2008 and the scheduled delivery date value in the record is 12/01/2007, the correct result should be 2 month difference between these two date values, but could someone here give us the technical light on how to make this happen in query design?
    Thanks and we will give you reward points for the correct anwsers!

    Hi Kevin,
    The Badi is RSR_OLAP_BADI.
    You can create an implementation using Transaction  SE18.
    The implementation is per cube and is defined in the filters.
    In the Implementation you have the following methods :
    1. Define : Here you will provide the Keyfigure you need as a virtual one.
    2. Initilialize : Any Init Function you want to do.
    3. Compute. This is called per datarecord and here you can cimpute your value.
    Hope this helps.
    Pralay Ahluwalia

  • In BADi , How to pass the values between two Method

    Hi Experts,
    We have two methods in BADis. How to pass the value  between two Methods. Can you guys explain me out with one example...
    Thanks & Regards,
    Sivakumar S

    Hi Sivakumar!
    Create a function group.
    Define global data (there is a similiar menu point to jump to the top include).
    Create one or two function modules, with which you can read and write the global data.
    In your BADI methods you can access the global data with help of your function modules. It will stay in memory through the whole transaction.
    Regards,
    Christian

  • Need to know how to calculate and allocate the server side bandwidth between two exchange sites for DAG replication

    Hi All,
    Please have a look in to the below mentioned environment.
    primary site :SITE 1
    server 1 
    server 2 
    secondary site :SITE 2
    server 3
    Note : All the above three servers are in single DAG .All the database are mounted on the server (server 1) which is located in the primary site (I.E SITE 1).
    On that 5 databases we are having 3500 users .Based on the user designation we have allocated the mailbox size.
    Query : Each and every day we are having the large no copy queue length for all the five databases to the server located in SITE 2.
    Please help me out on this and also tell me is there any tool available to exactly get the required bandwidth for the exchange servers located between the active directory sites.
    Thanks & Regards S.Nithyanandham

    I don't know of any tool that can calculate things for you but latency is the biggest thing you have to worry about. The other issues is looking at the network gear between the 2 sites. I have seen many times were switches get maxed out if they are set to
    1 GB or even ports getting maxed out and need to bonded for more throughput. Test your latency from the edge of each site then test it within to see if there is a difference. 
    Regardless of their geographic location relative to other DAG members, each member of the DAG must have round trip network latency no greater than 500 milliseconds between each other member.
    As the round trip latency between two Mailbox servers hosting copies of a database increases, the potential for replication not being up to date also increases. Regardless of the latency of the solution, customers should validate that the networks between
    all DAG members is capable of satisfying the data protection and availability goals of the deployment. Configurations with higher latency values may require special tuning of DAG, replication, and network parameters, such as increasing the number of databases
    or decreasing the number of mailboxes per database, to achieve the desired goals.
    Round trip latency requirements may not be the most stringent network bandwidth and latency requirement for a multi-datacenter configuration. You must evaluate the total network load, which
    includes client access, Active Directory, transport, continuous replication, and other application traffic, to determine the necessary network requirements for your environment.
    http://technet.microsoft.com/en-us/library/dd638104(v=exchg.150).aspx
    DJ Grijalva | MCITP: EMA 2007/2010 SPA 2010 | www.persistentcerebro.com

  • File to be put in two queues

    Hi all,
    I have a scenario like this.
    R/3 (idoc)->XI->MQ(two queue name)->External application
    Here in the receiver side, I have to give two queue names.
    Because the external application has to receive message from two different queues.
    The question is
    can i give two queue names for the same receiver service?
    Can anyone throw some light on this scenario?
    Thanks,
    Deno

    Deno,
    I beleive Robin's answer is explanatory. However, i will try to explain what i understand.
    You have to configure 2 instances of JMS adapter, one for each queue.
    Now, create two receiver agreements referring to these 2 adapters(If you are sending the same message without any transformation to both queues, you can create two inbound async interfaces with different name, but still referring to the same MessageType). This is because you will not be able to create two receiver determinations with the same receiver interface name.
    Now create an interface determination, and refer to both receiver interfaces craeted above here, recv i/f1 & recv i/f 2. Associate this i/f determination with your receiver determination and it should work.
    cheers
    Saravana

  • How to Transport G/L Accounts between two systems?

    Hi,
    I am trying to move the Chart Of Accounts along with Company dependent data from our Dev to QA system. I used transaction OBY9 to transport the chart of accounts however, it is only transporting chart of accounts related data and I had to re-create those accounts in Company Code.
    I also tried to use FS15 and FS16 between two systems however, no luck. Could you please provide any guidance based on your experience?
    Thanks,
    Durgesh.

    Hi John,
    For activating ALE for a particular message type there are following prerequisites:
    1. Set up the RFC Connection (ABAP) between two systems
    2. Configure model view in Sender system
    3. Distribute Model view  from sender system
    4. Generate partner profile from sender system (In sender system go to tcode WE20 go to partner type LS and maintain outbound parameter for message type GLMAST)
    5. In receiving system go to tcode WE20 go to partner type LS and maintain Inbound parameter --> Message type GLMAST and Process code GLMA.
    Save entries and the above should work for you.
    Generate IDOC for one GL Account and try to send company code date for one company code first. The message will appear which says "one idoc transferred".
    Regards
    Kapil

  • How to compare data between two tables?

    Hi,
    My team is trying to develop a SAP data migration tool (DMT) using ABAP.
    One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
    The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
    How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
    Any help would be greatly appreciated, thanks!

    Hi Kian,
    Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
    Thanks,
    Vinay

Maybe you are looking for

  • 2014 Macbook Pro 10.9.5 not discovering my iPhone 5s iOS8

    Why is Airdrop on my new Macbook Pro 10.9.5 not discovering my iPhone 5s iOS8.0.2 Bluetooth on. On same wireless home network. Selected Airdrop to everyone on my iPhone 5s. Macbook Pro was bought in August still not discovering my iphone. Airdrop ico

  • How many devices can you have on find my phone

    I have 4 apple devices that I can locate on find my phone. For some reason it won't find the 5th device iPod 4th gen

  • MRS: PRT Tool Resource does not appear in Planning Board

    Hi Experts, I am trying to perform tool assignment but somehow the tool resource does not appear in the planning board.  I have the following set up: - Tool created as both material and Equipment (category P) - Equipment assigned to work center linke

  • Batch number auto generation nedded

    hi all,               i have a query that when i make a GRPO of 10 items with different qty, these items are set to batch on every transaction, then it will ask to enter the batch number of all item with the number of their quantity, is there any pro

  • Unable to find OSB API classes while submitting the resources to OER

    Hi, i had installed weblogic 11gR1 and installed OSB and OER on top of it. when i try to submit any xsd or WSDL file from eclipse to Oracle Enterprise Repository it will work fine. But when i try to submit any .biz or .proxy file (from osb project) i