Package javax.jms

Examples of javax.jms.XAQueueSession


            if (clientId != null && clientId.length() > 1)
                con.setClientID(userName);
            con.start();

            // enlist the XAResource
            XAQueueSession session = con.createXAQueueSession();
            XAResource resource = session.getXAResource();

            if (TransactionUtil.getStatus() == TransactionUtil.STATUS_ACTIVE)
                TransactionUtil.enlistResource(resource);

            Queue queue = (Queue) jndi.lookup(queueName);
            QueueSession qSession = session.getQueueSession();
            QueueSender sender = qSession.createSender(queue);

            // create/send the message
            Message message = makeMessage(session, modelService, context);

            sender.send(message);

            if (TransactionUtil.getStatus() != TransactionUtil.STATUS_ACTIVE)
                session.commit();

            Debug.logInfo("Message sent.", module);

            // close the connections
            sender.close();
            session.close();
            con.close();
        } catch (GenericTransactionException gte) {
            throw new GenericServiceException("Problems enlisting resource w/ transaction manager.", gte.getNested());
        } catch (NamingException ne) {
            throw new GenericServiceException("Problems with JNDI lookup.", ne);
View Full Code Here


        if ( !transacted && !inJtaTransaction() ) {
            ret = getQueueConnection().createQueueSession ( false, ackMode );
            // TODO test non-tx mode
        } else {
          forceConnectionIntoXaMode ( getConnection() );
            XAQueueSession xasession = getQueueConnection().createXAQueueSession ();
            ret = new JtaQueueSession ( xasession, getTransactionalResource() ,
                    xasession.getXAResource () );
        }

        return ret;

    }
View Full Code Here

            if (clientId != null && clientId.length() > 1)
                con.setClientID(userName);
            con.start();

            // enlist the XAResource
            XAQueueSession session = con.createXAQueueSession();
            XAResource resource = session.getXAResource();

            if (TransactionUtil.getStatus() == TransactionUtil.STATUS_ACTIVE)
                TransactionUtil.enlistResource(resource);

            Queue queue = (Queue) jndi.lookup(queueName);
            QueueSession qSession = session.getQueueSession();
            QueueSender sender = qSession.createSender(queue);

            // create/send the message
            Message message = makeMessage(session, modelService, context);

            sender.send(message);

            if (TransactionUtil.getStatus() != TransactionUtil.STATUS_ACTIVE)
                session.commit();

            Debug.logInfo("Message sent.", module);

            // close the connections
            sender.close();
            session.close();
            con.close();
        } catch (GenericTransactionException gte) {
            throw new GenericServiceException("Problems enlisting resource w/ transaction manager.", gte.getNested());
        } catch (NamingException ne) {
            throw new GenericServiceException("Problems with JNDI lookup.", ne);
View Full Code Here

            catch (JMSException e)
            {
                fail("cannot create queue connection: " + e.getMessage());
            }
            // create xa session
            XAQueueSession session = null;
            try
            {
                session = _xaqueueConnection.createXAQueueSession();
            }
            catch (JMSException e)
View Full Code Here

        if (!isBroker08())
        {
            _queue = (Queue) getInitialContext().lookup(QUEUENAME);
            _queueFactory = getConnectionFactory();
            _xaqueueConnection = _queueFactory.createXAQueueConnection("guest", "guest");
            XAQueueSession session = _xaqueueConnection.createXAQueueSession();
            _queueConnection = _queueFactory.createQueueConnection("guest","guest");
            _nonXASession = _queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
            init(session, _queue);
        }
    }
View Full Code Here

            catch (JMSException e)
            {
                fail("cannot create queue connection: " + e.getMessage());
            }
            // create xa session
            XAQueueSession session = null;
            try
            {
                session = _xaqueueConnection.createXAQueueSession();
            }
            catch (JMSException e)
View Full Code Here

        if (!isBroker08())
        {
            _queue = (Queue) getInitialContext().lookup(QUEUENAME);
            _queueFactory = getConnectionFactory();
            _xaqueueConnection = _queueFactory.createXAQueueConnection("guest", "guest");
            XAQueueSession session = _xaqueueConnection.createXAQueueSession();
            _queueConnection = _queueFactory.createQueueConnection("guest","guest");
            _nonXASession = _queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
            init(session, _queue);
        }
    }
View Full Code Here

            if (clientId != null && clientId.length() > 1)
                con.setClientID(userName);
            con.start();

            // enlist the XAResource
            XAQueueSession session = con.createXAQueueSession();
            XAResource resource = session.getXAResource();

            if (TransactionUtil.getStatus() == TransactionUtil.STATUS_ACTIVE)
                TransactionUtil.enlistResource(resource);

            Queue queue = (Queue) jndi.lookup(queueName);
            QueueSession qSession = session.getQueueSession();
            QueueSender sender = qSession.createSender(queue);

            // create/send the message
            Message message = makeMessage(session, modelService, context);

            sender.send(message);

            if (TransactionUtil.getStatus() != TransactionUtil.STATUS_ACTIVE)
                session.commit();

            Debug.logInfo("Message sent.", module);

            // close the connections
            sender.close();
            session.close();
            con.close();
        } catch (GenericTransactionException gte) {
            throw new GenericServiceException("Problems enlisting resource w/ transaction manager.", gte.getNested());
        } catch (NamingException ne) {           
            throw new GenericServiceException("Problems with JNDI lookup.", ne);
View Full Code Here

        }
        else if (method.getName().equals("createQueueSession"))
        {
            if (tx != null)
            {
                XAQueueSession xaqs = ((XAQueueConnection) xaConnection).createXAQueueSession();
                return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
                    new Class[]{ QueueSession.class, XaTransaction.MuleXaObject.class },
                    new SessionInvocationHandler(xaqs, sameRMOverrideValue));
            }
            else
View Full Code Here

        if ( !transacted && !inJtaTransaction() ) {
            ret = getQueueConnection().createQueueSession ( false, ackMode );
            // TODO test non-tx mode
        } else {
          forceConnectionIntoXaMode ( getConnection() );
            XAQueueSession xasession = getQueueConnection().createXAQueueSession ();
            ret = new JtaQueueSession ( xasession, getTransactionalResource() ,
                    xasession.getXAResource () );
        }

        return ret;

    }
View Full Code Here

TOP

Related Classes of javax.jms.XAQueueSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.