Package javax.jms

Examples of javax.jms.TopicPublisher.send()


            log.debug("sent message "+i);
        }

        TextMessage message = session.createTextMessage();
        message.setText("");
        publisher.send(message);
        log.debug("sent end-of-communication message");

        log.info("Finished sending messages");

        // TO_DO: If I immediately close the producer after sending the messages, sometimes the
View Full Code Here


        assertNotNull(topic);
        TopicPublisher producer = session.createPublisher(topic);
        MessageConsumer consumer = session.createConsumer(topic);
        conn.start();
        TextMessage sentMessage = session.createTextMessage("Test Message");
        producer.send(sentMessage);
        TextMessage receivedMessage = (TextMessage) consumer.receive(2000);
        assertNotNull(receivedMessage);
        assertEquals(sentMessage.getText(), receivedMessage.getText());
        producer.send(sentMessage);
        receivedMessage = (TextMessage) consumer.receive(2000);
View Full Code Here

        TextMessage sentMessage = session.createTextMessage("Test Message");
        producer.send(sentMessage);
        TextMessage receivedMessage = (TextMessage) consumer.receive(2000);
        assertNotNull(receivedMessage);
        assertEquals(sentMessage.getText(), receivedMessage.getText());
        producer.send(sentMessage);
        receivedMessage = (TextMessage) consumer.receive(2000);
        assertNotNull(receivedMessage);
        assertEquals(sentMessage.getText(), receivedMessage.getText());

        conn.close();
View Full Code Here

        TemporaryTopic topic = session.createTemporaryTopic();
        assertNotNull(topic);
        TopicPublisher producer = session.createPublisher(topic);
        MessageConsumer consumer = session.createConsumer(topic);
        conn.start();
        producer.send(session.createTextMessage("hello"));
        TextMessage tm = (TextMessage) consumer.receive(2000);
        assertNotNull(tm);
        assertEquals("hello", tm.getText());

        try
View Full Code Here

            Topic topic = (Topic) ctx.lookup("topicName");
            TopicSession session = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            TopicPublisher publisher = session.createPublisher(topic);
            if (message != null) {
                Message msg = session.createTextMessage(message);
                publisher.send(msg);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

         ObjectMessage om3 = s.createObjectMessage();
         om3.setObject(to3);

         // send to topic
         publisher.send(om1);

         publisher.send(om2);

         publisher.send(om3);
View Full Code Here

         om3.setObject(to3);

         // send to topic
         publisher.send(om1);

         publisher.send(om2);

         publisher.send(om3);

         ObjectMessage rm1 = (ObjectMessage)sub.receive(HornetQServerTestCase.MAX_TIMEOUT);
View Full Code Here

         // send to topic
         publisher.send(om1);

         publisher.send(om2);

         publisher.send(om3);

         ObjectMessage rm1 = (ObjectMessage)sub.receive(HornetQServerTestCase.MAX_TIMEOUT);

         ObjectMessage rm2 = (ObjectMessage)sub.receive(HornetQServerTestCase.MAX_TIMEOUT);
View Full Code Here

        assertNotNull(topic);
        TopicPublisher producer = session.createPublisher(topic);
        MessageConsumer consumer = session.createConsumer(topic);
        conn.start();
        TextMessage sentMessage = session.createTextMessage("Test Message");
        producer.send(sentMessage);
        session.commit();
        TextMessage receivedMessage = (TextMessage) consumer.receive(2000);
        assertNotNull(receivedMessage);
        assertEquals(sentMessage.getText(), receivedMessage.getText());
        producer.send(sentMessage);
View Full Code Here

        producer.send(sentMessage);
        session.commit();
        TextMessage receivedMessage = (TextMessage) consumer.receive(2000);
        assertNotNull(receivedMessage);
        assertEquals(sentMessage.getText(), receivedMessage.getText());
        producer.send(sentMessage);
        session.commit();
        receivedMessage = (TextMessage) consumer.receive(2000);
        assertNotNull(receivedMessage);
        assertEquals(sentMessage.getText(), receivedMessage.getText());
        session.commit();
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.