Package javax.jms

Examples of javax.jms.ConnectionFactory.createConnection()


         Queue queue = (Queue)initialContext.lookup("queue/MyQueue");

         ConnectionFactory mcf =
            (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");

         Connection conn = mcf.createConnection();

         Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer p = s.createProducer(queue);
         p.setDeliveryMode(DeliveryMode.PERSISTENT);
         Message m = s.createTextMessage("one");
View Full Code Here


         conn.close();

         // receive the message
         ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
         conn = cf.createConnection();
         conn.start();
         s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer c = s.createConsumer(queue);
         TextMessage rm = (TextMessage)c.receive(1000);
View Full Code Here

      try
      {

         ConnectionFactory mcf =
            (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
         Connection conn = mcf.createConnection();
         conn.start();

         UserTransaction ut = ServerManagement.getUserTransaction();

         ut.begin();
View Full Code Here

         ut.commit();

         conn.close();

         ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
         conn = cf.createConnection();
         s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         conn.start();

         TextMessage rm = (TextMessage)s.createConsumer(queue).receive(500);
View Full Code Here

         conn.close();

         // receive the message
         cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
         conn = cf.createConnection();
         conn.start();
         s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer c = s.createConsumer(queue);
         rm = (TextMessage)c.receive(1000);
View Full Code Here

         // send a message to the queue

         ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
         Queue queue = (Queue)initialContext.lookup("queue/MyQueue2");
         Connection conn = cf.createConnection();
         Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer p = s.createProducer(queue);
         p.setDeliveryMode(DeliveryMode.PERSISTENT);
         Message m = s.createTextMessage("one");
         p.send(m);
View Full Code Here

         {
            // using a JCA wrapper

            ConnectionFactory mcf =
               (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
            conn = mcf.createConnection();
            conn.start();

            // no active JTA transaction here

            s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

   public void testBrowser() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
      Queue queue = (Queue)ic.lookup("/queue/MiscellaneousQueue");

      Connection conn = cf.createConnection();
      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = session.createProducer(queue);

      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
View Full Code Here

      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
      Queue queue = (Queue)ic.lookup("/queue/MiscellaneousQueue");

      // load the queue

      Connection c = cf.createConnection();
      Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = s.createProducer(queue);
      Message m = s.createMessage();
      prod.send(m);
      c.close();
View Full Code Here

      Message m = s.createMessage();
      prod.send(m);
      c.close();

      final Result result = new Result();
      Connection conn = cf.createConnection();
      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      final MessageConsumer cons = s.createConsumer(queue);
      cons.setMessageListener(new MessageListener()
      {
         public void onMessage(Message m)
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.