Package javax.jms

Examples of javax.jms.TemporaryTopic


    public void testUseFromAnotherSessionProhibited() throws Exception
    {
        final Connection conn = getConnection();
        final Session session1 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session1.createTemporaryTopic();

        try
        {
            session2.createConsumer(topic);
            fail("Expected a JMSException when subscribing to a temporary topic created on a different session");
View Full Code Here


    public void testDurableSubscriptionProhibited() throws Exception
    {
        final Connection conn = getConnection();

        final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session.createTemporaryTopic();
        assertNotNull(topic);
        try
        {
            session.createDurableSubscriber(topic, null);
            fail("Expected JMSException : should not be able to create durable subscription from temp topic");
        }
        catch (JMSException je)
        {
            //pass
            assertEquals("Cannot create a durable subscription with a temporary topic: " + topic.toString(), je.getMessage());
        }
    }
View Full Code Here

     */
    public void testTemporaryTopicReused() throws Exception
    {
        final Connection conn = getConnection();
        final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session.createTemporaryTopic();
        assertNotNull(topic);

        final MessageProducer producer = session.createProducer(topic);
        final MessageConsumer consumer1 = session.createConsumer(topic);
        conn.start();
View Full Code Here

     */
    public void testMessageDeliveryUsingTemporaryTopic() throws Exception
    {
        final Connection conn = getConnection();
        final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session.createTemporaryTopic();
        assertNotNull(topic);
        final MessageProducer producer = session.createProducer(topic);
        final MessageConsumer consumer1 = session.createConsumer(topic);
        final MessageConsumer consumer2 = session.createConsumer(topic);
        conn.start();
View Full Code Here

    public void testExplictTemporaryTopicDeletion() throws Exception
    {
        final Connection conn = getConnection();

        final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session.createTemporaryTopic();
        assertNotNull(topic);
        final MessageConsumer consumer = session.createConsumer(topic);
        conn.start();
        try
        {
            topic.delete();
            fail("Expected JMSException : should not be able to delete while there are active consumers");
        }
        catch (JMSException je)
        {
            //pass
            assertEquals("Temporary Topic has consumers so cannot be deleted", je.getMessage());
        }

        consumer.close();

        // Now deletion should succeed.
        topic.delete();

        try
        {
            session.createConsumer(topic);
            fail("Exception not thrown");
View Full Code Here

    public void testUseFromAnotherSessionProhibited() throws Exception
    {
        final Connection conn = getConnection();
        final Session session1 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final Session session2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session1.createTemporaryTopic();

        try
        {
            session2.createConsumer(topic);
            fail("Expected a JMSException when subscribing to a temporary topic created on a different session");
View Full Code Here

    public void testDurableSubscriptionProhibited() throws Exception
    {
        final Connection conn = getConnection();

        final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session.createTemporaryTopic();
        assertNotNull(topic);
        try
        {
            session.createDurableSubscriber(topic, null);
            fail("Expected JMSException : should not be able to create durable subscription from temp topic");
        }
        catch (JMSException je)
        {
            //pass
            assertEquals("Cannot create a durable subscription with a temporary topic: " + topic.toString(), je.getMessage());
        }
    }
View Full Code Here

     */
    public void testTemporaryTopicReused() throws Exception
    {
        final Connection conn = getConnection();
        final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final TemporaryTopic topic = session.createTemporaryTopic();
        assertNotNull(topic);

        final MessageProducer producer = session.createProducer(topic);
        final MessageConsumer consumer1 = session.createConsumer(topic);
        conn.start();
View Full Code Here

      synchronized (_tempTopics)
      {
         for (Iterator<TemporaryTopic> i = _tempTopics.iterator(); i.hasNext();)
         {
            TemporaryTopic temp = (TemporaryTopic)i.next();
            try
            {
               if (_log.isTraceEnabled())
               {
                  _log.trace("Closing temporary topic " + temp + " for " + this);
               }
               temp.delete();
            }
            catch (Throwable t)
            {
               _log.trace("Error deleting temporary queue", t);
            }
View Full Code Here

         if (_log.isTraceEnabled())
         {
            _log.trace("createTemporaryTopic " + Util.asString(session));
         }

         TemporaryTopic temp = session.createTemporaryTopic();

         if (_log.isTraceEnabled())
         {
            _log.trace("createdTemporaryTopic " + Util.asString(session) + " temp=" + temp);
         }
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.