Package javax.jms

Examples of javax.jms.TopicPublisher.publish()


        TopicSession session1 = con.createTopicSession(true, AMQSession.AUTO_ACKNOWLEDGE);
        TopicPublisher publisher = session1.createPublisher(topic);
        MessageConsumer consumer1 = session1.createConsumer(topic);
        con.start();
        TextMessage tm = session1.createTextMessage("Hello");
        publisher.publish(tm);
        session1.commit();
        tm = (TextMessage) consumer1.receive(10000L);
        assertNotNull(tm);
        String msgText = tm.getText();
        assertEquals("Hello", msgText);
View Full Code Here


        String msgText = tm.getText();
        assertEquals("Hello", msgText);
        tm = session1.createTextMessage();
        msgText = tm.getText();
        assertNull(msgText);
        publisher.publish(tm);
        session1.commit();
        tm = (TextMessage) consumer1.receive(10000L);
        assertNotNull(tm);
        session1.commit();
        msgText = tm.getText();
View Full Code Here

        session1.commit();
        msgText = tm.getText();
        assertNull(msgText);
        tm.clearBody();
        tm.setText("Now we are not null");
        publisher.publish(tm);
        session1.commit();
        tm = (TextMessage) consumer1.receive(2000);
        assertNotNull(tm);
        session1.commit();
        msgText = tm.getText();
View Full Code Here

        assertEquals("Now we are not null", msgText);

        tm = session1.createTextMessage("");
        msgText = tm.getText();
        assertEquals("Empty string not returned", "", msgText);
        publisher.publish(tm);
        session1.commit();
        tm = (TextMessage) consumer1.receive(2000);
        session1.commit();
        assertNotNull(tm);
        assertEquals("Empty string not returned", "", msgText);
View Full Code Here

        con.start();
        TextMessage m;
        TextMessage message;

        //send message to all consumers
        publisher.publish(session1.createTextMessage("hello-new2"));
        session1.commit();
        //test normal subscriber gets message
        m = (TextMessage) normal.receive(1000);
        assertNotNull(m);
        session1.commit();
View Full Code Here

        //send message to all consumers
        message = session1.createTextMessage("hello2");
        message.setStringProperty("Selector", "select");

        publisher.publish(message);
        session1.commit();

        //test normal subscriber gets message
        m = (TextMessage) normal.receive(1000);
        assertNotNull(m);
View Full Code Here


        message = session2.createTextMessage("hello2");
        message.setStringProperty("Selector", "select");

        publisher2.publish(message);
        session2.commit();

        //test normal subscriber gets message
        m = (TextMessage) normal.receive(1000);
        assertNotNull(m);
View Full Code Here

        TextMessage m;
        TextMessage message;

        // Send non-matching message
        message = session.createTextMessage("non-matching 1");
        publisher.publish(message);
        session.commit();

        // Send and consume matching message
        message = session.createTextMessage("hello");
        message.setStringProperty("Selector", "select");
View Full Code Here

        // Send and consume matching message
        message = session.createTextMessage("hello");
        message.setStringProperty("Selector", "select");

        publisher.publish(message);
        session.commit();

        m = (TextMessage) selector.receive(1000);
        assertNotNull("should have received message", m);
        assertEquals("Message contents were wrong", "hello", m.getText());
View Full Code Here

        assertNotNull("should have received message", m);
        assertEquals("Message contents were wrong", "hello", m.getText());

        // Send non-matching message
        message = session.createTextMessage("non-matching 2");
        publisher.publish(message);
        session.commit();

        // Assert queue count is 0
        long depth = ((AMQTopicSessionAdaptor) session).getSession().getQueueDepth(topic);
        assertEquals("Queue depth was wrong", 0, depth);
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.