Package javax.jms

Examples of javax.jms.QueueSession.commit()


         // second message cannot be received
         // if the first message is not committed.
         mr = (TextMessage)cons.receive(3000);
         assertNull(mr);

         sess.commit();

         mr = (TextMessage)cons.receive(3000);
         assertNotNull(mr);
         assertEquals("testing2", mr.getText());
View Full Code Here


         mr = (TextMessage)cons.receive(3000);
         assertNotNull(mr);
         assertEquals("testing2", mr.getText());

         sess.commit();

         checkEmpty(queue1);
      }
      finally
      {
View Full Code Here

            // send the message
            sender.send( message );

            if( session.getTransacted()) {
                session.commit();
            }
            if (i%1000 == 0) {
                logger.info( "Message successfully sent to : " + queue.getQueueName( ) + " messageid: " + message.getJMSMessageID( )
                        + " content:" + message.getText());
            }
View Full Code Here

                            this.handler.onMessage(message);
                        }

                        // commit session on successful handling of message
                        if( session.getTransacted()) {
                            session.commit();
                        }
                    }

                    logger.info( "Receiver " + Thread.currentThread().getName() + " shutting down." );
View Full Code Here

      s_send.commit();
      /* Receive the message */
      msg = (TextMessage) qr.receiveNoWait();
      Assert.assertNotNull("message recieved", msg);
      /* Commit the session to clear the queue */
      s_rec.commit();
      /* Check, that the text of the message is still the same */
      Assert.assertEquals("text is not the same " + msg.getText(), msg
          .getText(), TEXT);
    } finally {
      try {
View Full Code Here

      s_send.commit();
      /* Receive the message */
      msg = (MapMessage) qr.receiveNoWait();
      Assert.assertNotNull("message recieved", msg);
      /* Commit the session to clear the queue */
      s_rec.commit();
      /* Check, that the text of the message is still the same */
      Assert.assertEquals("byte", msg.getByte("byte"), (byte) 0);
      Assert.assertEquals("boolean", msg.getBoolean("boolean"), true);
      Assert.assertEquals("char", msg.getChar("char"), 'c');
      Assert.assertEquals("double", msg.getDouble("double"), 1.11d, 0);
View Full Code Here

      /* Receive the message */
      msg = (StreamMessage) qr.receiveNoWait();
     
      Assert.assertNotNull("message recieved", msg);
      /* Commit the session to clear the queue */
      s_rec.commit();
      /* Check, that the text of the message is still the same */
     
      Assert.assertEquals("byte", msg.readByte(), (byte) 0);
      Assert.assertEquals("boolean", msg.readBoolean(), true);
      Assert.assertEquals("char", msg.readChar(), 'c');
View Full Code Here

                for(int i = 0; i < num; i++) {
                    qsender.send(msgs[i]);
                    sleep(100);
                }
                /* Commit the sending session */
                qs.commit();
            } catch(Exception ex) {
                ex.printStackTrace();
            } finally {
                try { qs.close(); } catch(Exception ex) {}
            }
View Full Code Here

            s_send.commit();
            /* Receive the message */
            msg = qr.receiveNoWait();
            Assert.assertNotNull("message recieved", msg);
            /* Commit the session to clear the queue */
            s_rec.commit();
            /* Check, if the headers are set */
            Assert.assertNull("JMSCorrelationID", msg.getJMSCorrelationID());
            Assert.assertEquals("JMSDestination", q.getQueueName(), ((Queue)msg.getJMSDestination()).getQueueName());
            Assert.assertEquals("JMSDeliveryMode", msg.getJMSDeliveryMode(), DeliveryMode.PERSISTENT);
            Assert.assertEquals("JMSExpiration", Message.DEFAULT_TIME_TO_LIVE, msg.getJMSExpiration());
View Full Code Here

            /* Commit the sending session */
            s_send.commit();
            /* Receive the message */
            msg = qr.receiveNoWait();
            /* Commit the session to clear the queue */
            s_rec.commit();
            /* Check, if the headers are set */
            Assert.assertEquals(PROP1, VAL1, msg.getStringProperty(PROP1));
            Assert.assertEquals(PROP2, VAL2, msg.getStringProperty(PROP2));
            Assert.assertEquals(PROP3, VAL3, msg.getStringProperty(PROP3));
            Assert.assertEquals(PROP4, VAL4, msg.getLongProperty(PROP4));
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.