Package javax.jms

Examples of javax.jms.TopicPublisher.publish()


            con.start();
            session1 = con.createTopicSession(false, AMQSession.NO_ACKNOWLEDGE);
            publisher = session1.createPublisher(null);
        }
        TopicSubscriber sub2 = session1.createDurableSubscriber(topic2, "subscription0");
        publisher.publish(topic, session1.createTextMessage("hello"));
        if (!shutdown)
        {
            m = (TextMessage) sub.receive(2000);
            assertNull(m);
        }
View Full Code Here


        if (!shutdown)
        {
            m = (TextMessage) sub.receive(2000);
            assertNull(m);
        }
        publisher.publish(topic2, session1.createTextMessage("goodbye"));
        m = (TextMessage) sub2.receive(2000);
        assertNotNull(m);
        assertEquals("goodbye", m.getText());
        con.close();
    }
View Full Code Here

        TopicSession session2 = con2.createTopicSession(false, AMQSession.NO_ACKNOWLEDGE);
        TopicSubscriber sub = session2.createDurableSubscriber(topic, "subscription0");

        con2.start();

        publisher.publish(session1.createTextMessage("Hello"));
        TextMessage tm = (TextMessage) sub.receive(2000);
        assertNotNull(tm);
        con2.close();
        publisher.publish(session1.createTextMessage("Hello2"));
        con2 = new AMQConnection("vm://:1?retries='0'", "guest", "guest", "test2", "test");
View Full Code Here

        publisher.publish(session1.createTextMessage("Hello"));
        TextMessage tm = (TextMessage) sub.receive(2000);
        assertNotNull(tm);
        con2.close();
        publisher.publish(session1.createTextMessage("Hello2"));
        con2 = new AMQConnection("vm://:1?retries='0'", "guest", "guest", "test2", "test");
        session2 = con2.createTopicSession(false, AMQSession.NO_ACKNOWLEDGE);
        sub = session2.createDurableSubscriber(topic, "subscription0");
        con2.start();
        tm = (TextMessage) sub.receive(2000);
View Full Code Here

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

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

        assertNotNull(tm);
        msgText = tm.getText();
        assertNull(msgText);
        tm.clearBody();
        tm.setText("Now we are not null");
        publisher.publish(tm);
        tm = (TextMessage) consumer1.receive(2000);
        assertNotNull(tm);
        msgText = tm.getText();
        assertEquals("Now we are not null", msgText);
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);
        tm = (TextMessage) consumer1.receive(2000);
        assertNotNull(tm);
        assertEquals("Empty string not returned", "", msgText);
        con.close();
    }
View Full Code Here

            /* create a message for sending */
            Message msg = s_send.createObjectMessage(new Integer(1));
            msg.setIntProperty("size", 2);
            msg.setStringProperty("color", "black");
            //Publish the message
            tpub.publish(msg);
            s_send.commit();

            Message msg1 = ts1.receiveNoWait();
            Message msg2 = ts2.receiveNoWait();
            Message msg3 = ts3.receiveNoWait();
View Full Code Here

            /* create another message for sending */
            msg = s_send.createObjectMessage(new Integer(88));
            msg.setIntProperty("size", 2);
            msg.setStringProperty("color", "green");
            //Publish the message
            tpub.publish(msg);
            s_send.commit();

            msg1 = ts1.receiveNoWait();
            msg2 = ts2.receiveNoWait();
            msg3 = ts3.receiveNoWait();
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.