// Publish 5 persistent messages, 256k chars to ensure they are multi-frame
sendMessages(session, messageProducer, queue, DeliveryMode.PERSISTENT, 256*1024, 5);
// Publish 5 persistent messages, 1k chars to ensure they are single-frame
sendMessages(session, messageProducer, queue, DeliveryMode.PERSISTENT, 1*1024, 5);
session.commit();
// Publish 5 persistent messages which will NOT be committed and so should be 'lost'
sendMessages(session, messageProducer, queue, DeliveryMode.PERSISTENT, 1*1024, 5);
messageProducer.close();
session.close();