Package javax.jms

Examples of javax.jms.TopicSubscriber.receive()


     
      producer.send(session.createTextMessage("testDurableWithInvalidSelector2"));
      Message msg = liveSubscriber.receive(POSITIVE_RECEIVE_TIMEOUT);
      assertNotNull ("Message should have been received", msg);
      assertEquals ("testDurableWithInvalidSelector2", ((TextMessage) msg).getText());
      assertNull("Should not receive subsequent message", liveSubscriber.receive(200));

        session.unsubscribe("testDurableWithInvalidDestinationsub");
    }
   
    /**
 
View Full Code Here


        assertNotNull(rMsg);
        assertEquals("Content was wrong",
                     "testResubscribeWithChangedSelector1",
                     ((TextMessage) rMsg).getText());
       
        rMsg = subA.receive(NEGATIVE_RECEIVE_TIMEOUT);
        assertNull(rMsg);
       
        // Disconnect subscriber
        subA.close();
       
View Full Code Here

        // Reconnect with new selector that matches B
        TopicSubscriber subB = session.createDurableSubscriber(topic,
                "testResubscribeWithChangedSelector","Match = False", false);

        //verify no messages are now recieved.
        rMsg = subB.receive(NEGATIVE_RECEIVE_TIMEOUT);
        assertNull("Should not have received message as the selector was changed", rMsg);

        // Check that new messages are received properly
        sendMatchingAndNonMatchingMessage(session, producer);
        rMsg = subB.receive(POSITIVE_RECEIVE_TIMEOUT);
View Full Code Here

        rMsg = subB.receive(NEGATIVE_RECEIVE_TIMEOUT);
        assertNull("Should not have received message as the selector was changed", rMsg);

        // Check that new messages are received properly
        sendMatchingAndNonMatchingMessage(session, producer);
        rMsg = subB.receive(POSITIVE_RECEIVE_TIMEOUT);

        assertNotNull("Message should have been received", rMsg);
        assertEquals("Content was wrong",
                     "testResubscribeWithChangedSelector2",
                     ((TextMessage) rMsg).getText());
View Full Code Here

        assertEquals("Content was wrong",
                     "testResubscribeWithChangedSelector2",
                     ((TextMessage) rMsg).getText());
       
       
        rMsg = subB.receive(NEGATIVE_RECEIVE_TIMEOUT);
        assertNull("Message should not have been received",rMsg);
        session.unsubscribe("testResubscribeWithChangedSelector");
    }

    public void testDurableSubscribeWithTemporaryTopic() throws Exception
View Full Code Here

        // now recreate the durable subscriber and check the received messages
        TopicSubscriber subTwo = session.createDurableSubscriber(topic, "sameMessageSelector", "testprop = TRUE", false);

        for (int i = 0; i < 5; i++)
        {
            Message message = subTwo.receive(1000);
            if (message == null)
            {
                fail("sameMessageSelector test failed. no message was returned");
            }
            else
View Full Code Here

        AMQQueue queue = new AMQQueue("amq.topic", "clientid" + ":" + "testResubscribeWithChangedSelectorNoClose");
        assertEquals("Queue depth is wrong", isJavaBroker() ? 1 : 2, ((AMQSession<?, ?>) session).getQueueDepth(queue, true));

        conn.start();
       
        Message rMsg = subB.receive(POSITIVE_RECEIVE_TIMEOUT);
        assertNotNull(rMsg);
        assertEquals("Content was wrong",
                     "testResubscribeWithChangedSelectorAndRestart2",
                     ((TextMessage) rMsg).getText());
       
View Full Code Here

        assertNotNull(rMsg);
        assertEquals("Content was wrong",
                     "testResubscribeWithChangedSelectorAndRestart2",
                     ((TextMessage) rMsg).getText());
       
        rMsg = subB.receive(1000);
        assertNull(rMsg);
       
        // Check queue has no messages
        assertEquals("Queue should be empty", 0, ((AMQSession<?, ?>) session).getQueueDepth(queue, true));
       
View Full Code Here

        AMQQueue queue = new AMQQueue("amq.topic", "clientid" + ":" + "subscriptionName");
        assertEquals("Queue depth is wrong", isJavaBroker() ? 1 : 2, ((AMQSession<?, ?>) session).getQueueDepth(queue, true));
       
        conn.start();
       
        Message rMsg = subTwo.receive(POSITIVE_RECEIVE_TIMEOUT);
        assertNotNull(rMsg);
        assertEquals("Content was wrong",
                     "testResubscribeWithChangedSelectorAndRestart1",
                     ((TextMessage) rMsg).getText());
       
View Full Code Here

        assertNotNull(rMsg);
        assertEquals("Content was wrong",
                     "testResubscribeWithChangedSelectorAndRestart1",
                     ((TextMessage) rMsg).getText());
       
        rMsg = subTwo.receive(1000);
        assertNull(rMsg);
       
        // Check queue has no messages
        assertEquals("Queue should be empty", 0, ((AMQSession<?, ?>) session).getQueueDepth(queue, true));
       
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.