Package javax.jms

Examples of javax.jms.XAQueueSession


        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

        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

    }
  }

  protected void sendToQueueXA(Queue queue, XAQueueConnectionFactory xaQueueConnectionFactory) throws Exception {
    XAQueueConnection xaQueueConnection = null;
    XAQueueSession xaQueueSession = null;
    MessageProducer messageProducer = null;

    try {
      xaQueueConnection = xaQueueConnectionFactory.createXAQueueConnection();
      xaQueueSession = xaQueueConnection.createXAQueueSession();
      messageProducer = xaQueueSession.createProducer(queue);
      Message message = createMessage(xaQueueSession);
      messageProducer.send(message);

    } finally {
      try {
        messageProducer.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
      try {
        xaQueueSession.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
      try {
        xaQueueConnection.close();
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.