Package javax.jms

Examples of javax.jms.QueueConnection.createQueueSession()


      final QueueConnectionFactory factory = (QueueConnectionFactory) NAMING_CONTEXT
            .lookup(JNDI_NAME_CONNECTION_FACTORY);

      // Make a Connection
      final QueueConnection connection = factory.createQueueConnection();
      final QueueSession sendSession = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

      // Make the message
      final TextMessage message = sendSession.createTextMessage(contents);

      // Send the message
View Full Code Here


        try {

            PrintWriter out = arg1.getWriter();
            QueueConnection connection = qcf.createQueueConnection();
            connection.start();
            QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            QueueReceiver queueReceiver = session.createReceiver(queue);
            Message msg = queueReceiver.receiveNoWait();

            if ( msg instanceof TextMessage ) {
                TextMessage txtMsg = (TextMessage)msg;
View Full Code Here

                try {
                    qConFactory = (QueueConnectionFactory) kernel.invoke(
                            ObjectName.getInstance(CONNECTION_FACTORY_NAME),
                            "$getResource");
                    qConnection = qConFactory.createQueueConnection();
                    qSession = qConnection.createQueueSession(false,
                            QueueSession.AUTO_ACKNOWLEDGE);
                    qBrowser = qSession.createBrowser(queue);
                    qConnection.start();
                    for (Enumeration e = qBrowser.getEnumeration(); e
                            .hasMoreElements();) {
View Full Code Here

            QueueConnectionFactory qcf = lookup(server, "RemoteConnectionFactory", QueueConnectionFactory.class);
            Queue queue = lookup(server, queueName, Queue.class);

            conn = qcf.createQueueConnection();
            conn.start();
            session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

            // Set the async listener
            QueueReceiver recv = session.createReceiver(queue);
            recv.setMessageListener(new MessageListener() {
View Full Code Here

            QueueConnectionFactory qcf = lookup(utils, "RemoteConnectionFactory", QueueConnectionFactory.class);
            Queue queue = lookup(utils, QUEUE_NAME, Queue.class);

            conn = qcf.createQueueConnection();
            conn.start();
            session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

            // Set the async listener
            QueueReceiver recv = session.createReceiver(queue);
            recv.setMessageListener(new MessageListener() {
View Full Code Here

            QueueConnectionFactory qcf = lookup(utils, "RemoteConnectionFactory", QueueConnectionFactory.class);
            Queue queue = lookup(utils, "queue/test", Queue.class);
            conn = qcf.createQueueConnection();
            conn.start();
            session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

            // Set the async listener
            QueueReceiver recv = session.createReceiver(queue);
            recv.setMessageListener(new MessageListener() {
View Full Code Here

    QueueSender sender;
    QueueSession session;
    try {
      cnn = factory.getJMSFactory().createQueueConnection();
      //TODO make transacted parameterized
      session = cnn.createQueueSession( false, QueueSession.AUTO_ACKNOWLEDGE );

      ObjectMessage message = session.createObjectMessage();
      message.setObject( (Serializable) filteredQueue );

      sender = session.createSender( factory.getJmsQueue() );
View Full Code Here

            if (userName != null) {
                conn = factory.createQueueConnection(userName, password);
            } else {
                conn = factory.createQueueConnection();
            }
            final QueueSession sess = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            final Queue queue = (Queue) lookup(context, queueBindingName);
            final QueueSender sender = sess.createSender(queue);
            conn.start();
            return new QueueInfo(conn, sess, sender);
        } catch (final NamingException ex) {
View Full Code Here

            final Context ctx = new InitialContext();
            QueueConnectionFactory queueConnectionFactory;
            queueConnectionFactory = (QueueConnectionFactory) lookup(ctx, qcfBindingName);
            final QueueConnection queueConnection = queueConnectionFactory.createQueueConnection(username, password);
            queueConnection.start();
            final QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            final Queue queue = (Queue) ctx.lookup(queueBindingName);
            final QueueReceiver queueReceiver = queueSession.createReceiver(queue);
            queueReceiver.setMessageListener(this);
        } catch (final JMSException e) {
            logger.error("Could not read JMS message.", e);
View Full Code Here

   }

   public void testCreateTopicOnAQueueSession() throws Exception
   {
      QueueConnection c = (QueueConnection)getConnectionFactory().createConnection();
      QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      try
      {
         s.createTopic("TestTopic");
         ProxyAssertSupport.fail("should throw IllegalStateException");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.