Package javax.jms

Examples of javax.jms.TemporaryTopic


   // Public --------------------------------------------------------

   public void testTemp() throws Exception
   {
      TemporaryTopic tempTopic = producerSession.createTemporaryTopic();

      MessageProducer producer = producerSession.createProducer(tempTopic);

      MessageConsumer consumer = consumerSession.createConsumer(tempTopic);

      connection.start();

      final String messageText = "This is a message";

      Message m = producerSession.createTextMessage(messageText);

      producer.send(m);

      TextMessage m2 = (TextMessage)consumer.receive(2000);

      assertNotNull(m2);

      assertEquals(messageText, m2.getText());

      try
      {
         tempTopic.delete();
         fail();
      }
      catch (JMSException e)
      {
         //Can't delete temp dest if there are open consumers
      }

      consumer.close();
      tempTopic.delete();


   }
View Full Code Here




   public void testTemporaryTopicBasic() throws Exception
   {
      TemporaryTopic tempTopic = producerSession.createTemporaryTopic();

      final MessageProducer producer = producerSession.createProducer(tempTopic);

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

      getLog().debug("Starting TemporaryTopicDelete test");
      connect();

      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TemporaryTopic topic = session.createTemporaryTopic();

      topic.delete();

      disconnect();

      getLog().debug("TemporaryTopicDelete passed");
   }
View Full Code Here

      getLog().debug("Starting InvaidDestinationTopicPublish test");
      connect();

      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TemporaryTopic topic = session.createTemporaryTopic();
      TopicPublisher publisher = session.createPublisher(topic);
      topic.delete();

      TextMessage message = session.createTextMessage("hello");
      boolean caught = false;
      try
      {
View Full Code Here

      try
      {
         TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         Topic topic = (Topic) context.lookup(TEST_TOPIC);
         TemporaryTopic temp = session.createTemporaryTopic();

         boolean caught = false;
         try
         {
            session.createSubscriber(null);
View Full Code Here

      getLog().debug("Starting TemporaryTopicDelete test");
      connect();

      Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      TemporaryTopic topic = session.createTemporaryTopic();

      topic.delete();

      disconnect();

      getLog().debug("TemporaryTopicDelete passed");
   }
View Full Code Here

      try
      {
         Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         Topic topic = (Topic) context.lookup(TEST_TOPIC);
         TemporaryTopic temp = session.createTemporaryTopic();

         boolean caught = false;
         try
         {
            session.createConsumer(null);
View Full Code Here

      try
      {
         Session session = getSession();
         if (trace)
            log.trace("createTemporaryTopic " + session);
         TemporaryTopic temp = session.createTemporaryTopic();
         if (trace)
            log.trace("createdTemporaryTopic " + session + " temp=" + temp);
         sf.addTemporaryTopic(temp);
         return temp;
      }
View Full Code Here

     
      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

        assertNotNull(destination.getQueueName());
    }

    @Test
    public void testTemporaryTopicCreation() throws Exception {
        TemporaryTopic destination = (TemporaryTopic)strategy.createTemporaryDestination(getSession(), true);
        assertNotNull(destination);
        assertNotNull(destination.getTopicName());
    }
View Full Code Here

TOP

Related Classes of javax.jms.TemporaryTopic

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.