Package javax.jms

Examples of javax.jms.TextMessage.acknowledge()


        pubishDoneToQeueuA = asyncSendTo(queueA, "Message 2");
        assertTrue(pubishDoneToQeueuA.await(2, TimeUnit.SECONDS));

        msg = (TextMessage)consumer.receive();
        assertEquals("Message 2", msg.getText());
        msg.acknowledge();
    }

    public void test2ndPubisherWithStandardConnectionThatIsBlocked() throws Exception {
        ConnectionFactory factory = createConnectionFactory();
        connection = (ActiveMQConnection)factory.createConnection();
View Full Code Here


        TextMessage tm2 = (TextMessage) consumer2.receive(2000);
        assertNotNull(tm2);
        assertEquals("msg2", tm2.getText());

        tm2.acknowledge();
        consumerSession.recover();

        TextMessage tm1 = (TextMessage) consumer.receive(2000);
        assertNotNull(tm1);
        assertEquals("msg1", tm1.getText());
View Full Code Here

                    if (counter.get() == 2) {
                        sendDone.await();
                        connection.close();
                        got2Done.countDown();
                    }
                    tm.acknowledge();
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            }
        });
View Full Code Here

      CountDownLatch pubishDoneToQeueuB = asyncSendTo(queueB, "Message 1");
      assertTrue( pubishDoneToQeueuB.await(2, TimeUnit.SECONDS) );
     
      TextMessage msg = (TextMessage) consumer.receive();
      assertEquals("Message 1", msg.getText());
      msg.acknowledge();
     
      pubishDoneToQeueuB = asyncSendTo(queueB, "Message 2");
      assertTrue( pubishDoneToQeueuB.await(2, TimeUnit.SECONDS) );
     
      msg = (TextMessage) consumer.receive();
View Full Code Here

      pubishDoneToQeueuB = asyncSendTo(queueB, "Message 2");
      assertTrue( pubishDoneToQeueuB.await(2, TimeUnit.SECONDS) );
     
      msg = (TextMessage) consumer.receive();
      assertEquals("Message 2", msg.getText());
      msg.acknowledge();
    }

    public void test2ndPubisherWithStandardConnectionThatIsBlocked() throws Exception {
        ConnectionFactory factory = createConnectionFactory();
        connection = (ActiveMQConnection) factory.createConnection();
View Full Code Here

        producer.send(session.createTextMessage("Second"));
       
        TextMessage message = (TextMessage)consumer.receive(1000);
        assertEquals("First", message.getText());
        assertFalse(message.getJMSRedelivered());
        message.acknowledge();
       
        message = (TextMessage)consumer.receive(1000);
        assertEquals("Second", message.getText());
        assertFalse(message.getJMSRedelivered());
       
View Full Code Here

        message = (TextMessage)consumer.receive(2000);
        assertEquals("Second", message.getText());
        assertTrue(message.getJMSRedelivered());
       
        message.acknowledge();
    }
   
    /**
     * Test to make sure that a Async recover works.
     *
 
View Full Code Here

                    TextMessage message = (TextMessage)msg;
                    switch( counter ) {
                      case 1:
                            assertEquals("First", message.getText());
                            assertFalse(message.getJMSRedelivered());
                            message.acknowledge();
                         
                            break;                       
                      case 2:
                            assertEquals("Second", message.getText());
                            assertFalse(message.getJMSRedelivered());
View Full Code Here

                            break;
                           
                      case 3:
                            assertEquals("Second", message.getText());
                            assertTrue(message.getJMSRedelivered());                           
                            message.acknowledge();
                          doneCountDownLatch.countDown();
                          break;
                         
                      default:
                          errorMessage[0]="Got too many messages: "+counter;
View Full Code Here

                    log.info("After kill on (kill on receive)");
                }
               
                TextMessage msg = (TextMessage)consumer.receive(50000);
               
                msg.acknowledge();
               
                if (killOnTransaction)
                {
                    latchCalled = true;
                    latch.countDown();
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.