Package javax.jms

Examples of javax.jms.TopicSession.createTextMessage()


         TopicSubscriber subscriber = session.createSubscriber(topic);
         subscriber.setMessageListener(this);
     
         TopicPublisher publisher = session.createPublisher(topic);
     
         TextMessage msg = session.createTextMessage();
         msg.setText("this is a simple jms test message");
         publisher.publish(msg);
     
         Thread.sleep(3000L);
         connection.stop();
View Full Code Here


         System.out.println("******   ClientID = " + conn.getClientID());
         TopicSession sess = conn.createTopicSession(true, 0);
         TopicPublisher pub = sess.createPublisher(topic);
         pub.setDeliveryMode(DeliveryMode.PERSISTENT);
        
         Message m = sess.createTextMessage("testing123");
         pub.publish(m);
         sess.commit();
        
         conn.close();
         conn = cf.createTopicConnection();
View Full Code Here

         TopicSession sess = conn.createTopicSession(true, 0);
         TopicPublisher pub = sess.createPublisher(topic);
         TopicSubscriber sub = sess.createSubscriber(topic);
         pub.setDeliveryMode(DeliveryMode.PERSISTENT);
        
         Message m = sess.createTextMessage("testing123");
         pub.publish(m);
         sess.commit();
        
         //receive but rollback
         TextMessage m2 = (TextMessage)sub.receive(3000);
View Full Code Here

         TopicSession sess = conn.createTopicSession(true, 0);
         TopicPublisher pub = sess.createPublisher(topic);
         TopicSubscriber cons = sess.createSubscriber(topic);
         conn.start();
        
         Message m = sess.createTextMessage("testing123");
         pub.publish(m);
         sess.commit();
        
         TextMessage m2 = (TextMessage)cons.receive(3000);
         assertNotNull(m2);
View Full Code Here

        
         TopicSession newsess = conn.createTopicSession(true, 0);
         TopicPublisher newpub = newsess.createPublisher(topic);
         TopicSubscriber newcons = newsess.createSubscriber(topic);
        
         Message m3 = newsess.createTextMessage("testing456");
         newpub.publish(m3);
         newsess.commit();
        
         TextMessage m4 = (TextMessage)newcons.receive(3000);
         assertNotNull(m4);
View Full Code Here

         // Create 1 durable subscription and 1 non-durable subscription
         s.createDurableSubscriber(topic, "Durable1");
         s.createSubscriber(topic);
        
         // Send 1 message
         prod.send(s.createTextMessage("First one"));        
        
         ObjectName destObjectName =
            new ObjectName("jboss.messaging.destination:service=Topic,name=TopicRemoveAllMessages");
        
         int count = ((Integer)ServerManagement.getAttribute(destObjectName, "AllMessageCount")).intValue();
View Full Code Here

         s = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
         prod = s.createProducer(topic);
         prod.setDeliveryMode(DeliveryMode.PERSISTENT);
  
         // Send another message
         prod.send(s.createTextMessage("Second one"));
        
         count = ((Integer)ServerManagement.getAttribute(destObjectName, "AllMessageCount")).intValue();
        
         assertEquals(1, count);
View Full Code Here

        
         s.createSubscriber(topic);
         s.createSubscriber(topic);
        
         //Send a couple of messages
         TextMessage tm1 = s.createTextMessage("message1");
         TextMessage tm2 = s.createTextMessage("message2");
        
         prod.send(tm1);
         prod.send(tm2);
  
View Full Code Here

         s.createSubscriber(topic);
         s.createSubscriber(topic);
        
         //Send a couple of messages
         TextMessage tm1 = s.createTextMessage("message1");
         TextMessage tm2 = s.createTextMessage("message2");
        
         prod.send(tm1);
         prod.send(tm2);
  
         // There should be 3 subscriptions
View Full Code Here

        
         MessageProducer prod = s.createProducer(topic);
         prod.setDeliveryMode(DeliveryMode.PERSISTENT);
        
         // Send a couple of messages
         TextMessage tm1 = s.createTextMessage("message1");
         TextMessage tm2 = s.createTextMessage("message2");
        
         prod.send(tm1);
         prod.send(tm2);
     
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.