/** * Sends a batch of messages and validates that the rollbacked message was * not consumed. This test differs by setting the message prefetch to one. * * @throws Exception */ public void testSendRollbackWithPrefetchOfOne() throws Exception { setPrefetchToOne(); testSendRollback(); }
/** * Sends a batch of messages and and validates that the rollbacked message * was redelivered. This test differs by setting the message prefetch to * one. * * @throws Exception */ public void testReceiveRollbackWithPrefetchOfOne() throws Exception { setPrefetchToOne(); testReceiveRollback(); }
/** * Sends a batch of messages and validates that the rollbacked message was * not consumed. * * @throws Exception */ public void testSendReceiveWithPrefetchOne() throws Exception { setPrefetchToOne(); Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message"), session.createTextMessage("Fourth Message")}; beginTx(); for (int i = 0; i < outbound.length; i++) { // sends a message producer.send(outbound[i]); } commitTx(); // receives the first message beginTx(); for (int i = 0; i < outbound.length; i++) { LOG.info("About to consume message 1"); Message message = consumer.receive(1000); assertNotNull(message); LOG.info("Received: " + message); } // validates that the rollbacked was not consumed commitTx(); }