TopicSession pubSession = connection.createTopicSession(true, Session.SESSION_TRANSACTED);
TopicPublisher publisher = pubSession.createPublisher(topic);
publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "true");
publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "false");
pubSession.commit();
publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "true");
publisher.close();
pubSession.close();
connection.close();