Package javax.jms

Examples of javax.jms.MessageProducer


      MessageConsumer sub2 = sessConsume.createDurableSubscriber(topic, "sub2", null, false);
      MessageConsumer sub3 = sessConsume.createDurableSubscriber(topic, "sub3", null, false);
     
     
      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = sessSend.createProducer(topic);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
     
      for (int i = 0; i < 10; i++)
      {
         TextMessage tm = sessSend.createTextMessage("message" + i);
         prod.send(tm);
      }
     
      conn.close();
     
      ServerManagement.stopServerPeer();
View Full Code Here


      Session sess21 = xaSess5.getSession();
      Session sess22 = xaSess6.getSession();
      Session sess23 = xaSess7.getSession();
      Session sess24 = xaSess8.getSession();
     
      MessageProducer prod1 = sess1.createProducer(queue1);
      prod1.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod2 = sess2.createProducer(queue1);
      prod2.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod3 = sess3.createProducer(queue1);
      prod3.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod4 = sess4.createProducer(queue1);
      prod4.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod5 = sess5.createProducer(queue1);
      prod5.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod6 = sess6.createProducer(queue1);
      prod6.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod7 = sess7.createProducer(queue1);
      prod7.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod8 = sess8.createProducer(queue1);
      prod8.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod9 = sess9.createProducer(queue1);
      prod9.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod10 = sess10.createProducer(queue1);
      prod10.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod11 = sess11.createProducer(queue1);
      prod11.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod12 = sess12.createProducer(queue1);
      prod12.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod13 = sess13.createProducer(queue1);
      prod13.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod14 = sess14.createProducer(queue1);
      prod14.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod15 = sess15.createProducer(queue1);
      prod15.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod16 = sess16.createProducer(queue1);
      prod16.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod17 = sess17.createProducer(queue1);
      prod17.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod18 = sess18.createProducer(queue1);
      prod18.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod19 = sess19.createProducer(queue1);
      prod19.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod20 = sess20.createProducer(queue1);
      prod20.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod21 = sess21.createProducer(queue1);
      prod21.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod22 = sess22.createProducer(queue1);
      prod22.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod23 = sess23.createProducer(queue1);
      prod23.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      MessageProducer prod24 = sess24.createProducer(queue1);
      prod24.setDeliveryMode(DeliveryMode.NON_PERSISTENT);


      Connection conn2 = cf.createConnection();
      conn2.start();
      Session sessReceive = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);     
View Full Code Here

      Connection conn1 = cf.createConnection();
     
      Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Session sess2 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);

      MessageProducer prod1 = sess1.createProducer(topic1);
      prod1.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
     
      MessageProducer prod2 = sess2.createProducer(topic1);
      prod2.setDeliveryMode(DeliveryMode.PERSISTENT);
                 
      Connection conn2 = cf.createConnection();
      conn2.setClientID("clientid1");
      conn2.start();
     
View Full Code Here

     
      Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
     
      Session sessReceive = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
     
      MessageProducer prod = sessSend.createProducer(queue1);
      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
     
      Runner[] runners = new Runner[] { new Sender("prod1", sessSend, prod, 100000),
                                        new Receiver(conn, sessReceive, 100000, queue1) };

      runRunners(runners);
View Full Code Here

        
         Session sessSend = conn.createSession(true, Session.SESSION_TRANSACTED);
         Session sess1 = conn.createSession(true, Session.SESSION_TRANSACTED);        
         MessageConsumer consumer1 = sess1.createConsumer(topic);
        
         MessageProducer producer = sessSend.createProducer(topic);
         Message mSent = sessSend.createTextMessage("igloo");
         producer.send(mSent);     
         sessSend.commit();
              
         conn.start();
             
         TextMessage mRec1 = (TextMessage)consumer1.receive(2000);
View Full Code Here

      try
      {
         conn = cf.createConnection();
  
         Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
         MessageProducer producer = sess.createProducer(topic);
        
         MessageConsumer consumer = sess.createConsumer(topic);
         conn.start();
  
        
         Message mSent = sess.createTextMessage("igloo");
         producer.send(mSent);
        
         sess.commit();
        
         TextMessage mRec = (TextMessage)consumer.receive(2000);
View Full Code Here

      {
     
         conn = cf.createConnection();
  
         Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
         MessageProducer producer = sess.createProducer(topic);
        
         MessageConsumer consumer = sess.createConsumer(topic);
         conn.start();
  
        
         TextMessage mSent = sess.createTextMessage("igloo");
         producer.send(mSent);
        
         sess.commit();
        
         TextMessage mRec = (TextMessage)consumer.receive(2000);
         assertEquals("igloo", mRec.getText());
        
         sess.commit();
        
         mSent.setText("rollback");
         producer.send(mSent);
        
         sess.commit();
        
         mRec = (TextMessage)consumer.receive(2000);
         sess.rollback();
View Full Code Here

      try
      {
         conn = cf.createConnection();
  
         Session producerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
         MessageProducer producer = producerSess.createProducer(topic);
  
         Session consumerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageConsumer consumer = consumerSess.createConsumer(topic);
         conn.start();
  
         final int NUM_MESSAGES = 10;
  
         //Send some messages
         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            Message m = producerSess.createMessage();
            producer.send(m);
         }
  
         log.trace("Sent messages");
  
         Message m = consumer.receive(2000);
View Full Code Here

      {
     
         conn = cf.createConnection();
        
         Session producerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
         MessageProducer producer = producerSess.createProducer(topic);
        
         Session consumerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
         MessageConsumer consumer = consumerSess.createConsumer(topic);
         conn.start();
        
         final int NUM_MESSAGES = 10;
        
         //Send some messages
         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            Message m = producerSess.createMessage();
            producer.send(m);
         }
        
         producerSess.commit();
        
         log.trace("Sent messages");
View Full Code Here

      {
     
         conn = cf.createConnection();
  
         Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer producer = producerSess.createProducer(topic);
  
         Session consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
         MessageConsumer consumer = consumerSess.createConsumer(topic);
         conn.start();
  
         final int NUM_MESSAGES = 10;
  
         //Send some messages
         for (int i = 0; i < NUM_MESSAGES; i++)
         {
            Message m = producerSess.createMessage();
            producer.send(m);
         }
  
         log.trace("Sent messages");
  
         int count = 0;
View Full Code Here

TOP

Related Classes of javax.jms.MessageProducer

Copyright © 2018 www.massapicom. 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.