TopicConnection pubConnection = factory.createTopicConnection("guest", "guest");
TopicSession pubSession = pubConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicPublisher publisher = pubSession.createPublisher(topic);
for (int i = 1; i <= 5; i++)
{
Message message = pubSession.createMessage();
message.setStringProperty("testprop", "true");
publisher.publish(message);
message = pubSession.createMessage();
message.setStringProperty("testprop", "false");
publisher.publish(message);