Connection conn = cf.createConnection();
for (int i=0; i<20; i++) System.out.println("*******************************************");
System.out.println("clientID = " + conn.getClientID());
Session producerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
MessageProducer producer = producerSess.createProducer(queue);
Session consumerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
MessageConsumer consumer = consumerSess.createConsumer(queue);
conn.start();
final int NUM_MESSAGES = 20;
for (int i = 0; i < NUM_MESSAGES; i++)
{
Message m = producerSess.createMessage();
producer.send(m);
}
assertRemainingMessages(NUM_MESSAGES);
log.trace("Sent " + NUM_MESSAGES + " messages");