Package javax.jms

Examples of javax.jms.TemporaryQueue


            Topic topic = (Topic)context.lookup(TEST_TOPIC);
            TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            Message message = session.createTextMessage();

            QueueSession qsession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            TemporaryQueue temp = qsession.createTemporaryQueue();
            message.setJMSReplyTo(temp);

            TopicPublisher publisher = session.createPublisher(topic);
            publisher.publish(message);
View Full Code Here


      try
      {
         MyMessageListener messageListener = new MyMessageListener();
        
         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         TemporaryQueue queue1 = session.createTemporaryQueue();
         QueueSender sender1 = session.createSender(queue1);
         QueueReceiver receiver1 = session.createReceiver(queue1);
         receiver1.setMessageListener(messageListener);
         TemporaryQueue queue2 = session.createTemporaryQueue();
         QueueSender sender2 = session.createSender(queue2);
         QueueReceiver receiver2 = session.createReceiver(queue2);
         receiver2.setMessageListener(messageListener);
         Message message = session.createMessage();
         queueConnection.start();
View Full Code Here

      try
      {
         Session session = getSession();
         if (trace)
            log.trace("createTemporaryQueue " + session);
         TemporaryQueue temp = session.createTemporaryQueue();
         if (trace)
            log.trace("createdTemporaryQueue " + session + " temp=" + temp);
         sf.addTemporaryQueue(temp);
         return temp;
      }
View Full Code Here

     
      synchronized (tempQueues)
      {
         for (Iterator i = tempQueues.iterator(); i.hasNext();)
         {
            TemporaryQueue temp = (TemporaryQueue) i.next();
            try
            {
               if (trace)
                  log.trace("Closing temporary queue " + temp + " for " + this);
               temp.delete();
            }
            catch (Throwable t)
            {
               log.trace("Error deleting temporary queue", t);
            }
            i.remove();
         }
      }
     
      synchronized (tempTopics)
      {
         for (Iterator i = tempTopics.iterator(); i.hasNext();)
         {
            TemporaryTopic temp = (TemporaryTopic) i.next();
            try
            {
               if (trace)
                  log.trace("Closing temporary topic " + temp + " for " + this);
               temp.delete();
            }
            catch (Throwable t)
            {
               log.trace("Error deleting temporary queue", t);
            }
View Full Code Here

   {
      connect();
      try
      {
         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         TemporaryQueue temp = session.createTemporaryQueue();
         session.createConsumer(temp);
         session.close();
         session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         session.createConsumer(temp).close();
      }
View Full Code Here

   {
      connect();
      try
      {
         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         TemporaryQueue temp = session.createTemporaryQueue();
         session.createConsumer(temp);
         disconnect();
         connect();
         session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
         try
View Full Code Here

        assertEquals("test", destination.getTopicName());
    }

    @Test
    public void testTemporaryQueueCreation() throws Exception {
        TemporaryQueue destination = (TemporaryQueue)strategy.createTemporaryDestination(getSession(), false);
        assertNotNull(destination);
        assertNotNull(destination.getQueueName());
    }
View Full Code Here

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createTemporaryQueue " + session);
         }

         TemporaryQueue temp = session.createTemporaryQueue();

         if (HornetQRASession.trace)
         {
            HornetQRASession.log.trace("createdTemporaryQueue " + session + " temp=" + temp);
         }
View Full Code Here

           
         }
        
         //Create a temp queue
        
         TemporaryQueue tempQueue = sess.createTemporaryQueue();
        
         counters = (List)
         ServerManagement.getAttribute(ServerManagement.getServerPeerObjectName(), "MessageCounters");
     
         assertNotNull(counters);
     
         //Temp queues don't have counters
         assertEquals(6, counters.size());
        
         //Send some messages
        
         MessageProducer prod = sess.createProducer(null);
        
         TextMessage tm1 = sess.createTextMessage("message1");
        
         TextMessage tm2 = sess.createTextMessage("message2");
        
         TextMessage tm3 = sess.createTextMessage("message3");
        
         prod.send(queue1, tm1);        
         prod.send(queue1, tm2);        
         prod.send(queue1, tm3);
        
         prod.send(queue2, tm1);        
         prod.send(queue2, tm2);        
         prod.send(queue2, tm3);
        
         prod.send(queue3, tm1);        
         prod.send(queue3, tm2);        
         prod.send(queue3, tm3);
        
         prod.send(tempQueue, tm1);        
         prod.send(tempQueue, tm2);        
         prod.send(tempQueue, tm3);
        
         prod.send(topic1, tm1);        
         prod.send(topic1, tm2);        
         prod.send(topic1, tm3);
        
         prod.send(topic2, tm1);        
         prod.send(topic2, tm2);        
         prod.send(topic2, tm3);
        
         iter = counters.iterator();
        
         //Wait until the stats are updated
         Thread.sleep(1500);
        
         while (iter.hasNext())
         {
            MessageCounter counter = (MessageCounter)iter.next();
           
            assertEquals(3, counter.getCount());
           
            assertEquals(3, counter.getCountDelta());
           
            assertEquals(-1, counter.getHistoryLimit());
           
         }
        
         while (iter.hasNext())
         {
            MessageCounter counter = (MessageCounter)iter.next();
               
            assertEquals(3, counter.getCount());
           
            assertEquals(0, counter.getCountDelta());
           
            assertEquals(-1, counter.getHistoryLimit());
           
         }
           
         ServerManagement.invoke(ServerManagement.getServerPeerObjectName(), "resetAllMessageCounters", null, null);
        
         ServerManagement.invoke(ServerManagement.getServerPeerObjectName(), "resetAllMessageCounterHistories", null, null);
        
        
         while (iter.hasNext())
         {
            MessageCounter counter = (MessageCounter)iter.next();
           
            assertEquals(0, counter.getCount());
           
            assertEquals(0, counter.getCountDelta());
           
            assertEquals(-1, counter.getHistoryLimit());           
         }
        
         String html = (String)ServerManagement.invoke(ServerManagement.getServerPeerObjectName(), "listMessageCountersAsHTML", null, null);
        
         assertNotNull(html);
        
         while (iter.hasNext())
         {
            MessageCounter counter = (MessageCounter)iter.next();

            assertTrue(html.indexOf(counter.getDestinationName()) != -1);          
         }
        
         List stats = (List)ServerManagement.getAttribute(ServerManagement.getServerPeerObjectName(), "MessageStatistics");
        
         assertNotNull(stats);
        
         assertEquals(6, stats.size());
        
         iter = stats.iterator();
        
         while (iter.hasNext())
         {
            MessageStatistics stat = (MessageStatistics)iter.next();
           
            assertEquals(0, stat.getCount());
           
            assertEquals(0, stat.getCountDelta());
           
            assertEquals(3, stat.getDepth());
           
            assertEquals(0, stat.getDepthDelta());  
         }
        
         cons1.close();
         cons2.close();
         cons3.close();
         sess.unsubscribe("sub1");
        
         counters = (List)
         ServerManagement.getAttribute(ServerManagement.getServerPeerObjectName(), "MessageCounters");
     
         assertNotNull(counters);
     
         assertEquals(3, counters.size());
                 
         tempQueue.delete();
        
        
         counters = (List)
         ServerManagement.getAttribute(ServerManagement.getServerPeerObjectName(), "MessageCounters");
     
View Full Code Here

         Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

         Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

         TemporaryQueue tempQueue = producerSession.createTemporaryQueue();

         MessageProducer producer = producerSession.createProducer(tempQueue);

         MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
View Full Code Here

TOP

Related Classes of javax.jms.TemporaryQueue

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.