SimpleReceiver r = new SimpleReceiver("AckingReceiver", SimpleReceiver.ACKING);
assertTrue(queue.add(r));
SimpleDeliveryObserver observer = new SimpleDeliveryObserver();
Transaction tx = tr.createTransaction();
MessageReference[] refs = new MessageReference[NUMBER_OF_MESSAGES];
for(int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
refs[i] = createReference(i, true, "payload" + i);
// transacted send, reliable message, multiple messages
// for a transactional send, handle() return value is unspecified
queue.handle(observer, refs[i], tx);
}
// no messages in the channel yet
assertEquals(0, queue.browse().size());
// no message at the receiver
assertTrue(r.getMessages().isEmpty());
tx.commit();
// no messages in the channel
assertEquals(0, queue.browse().size());
assertEqualSets(refs, r.getMessages());