// Use the static MQConnection.newInstance() method to instantiate a
// new connection
// for messagequeues and creates a JMS QueueReceiver for the given
// queue.
MQConnection mqCon = MQConnection.getInstance();
QueueReceiver qr = mqCon.getReceiver(new XBUSSystem(logQueuename));
int commitCounter = 0;
int messageCounter = 0;
// Use a TextMessage object to receive a message containing a
// java.lang.String
// in read-only mode.
TextMessage message = null;
boolean messageFound = false;
while (!messageFound && (messageCounter < numMessages))
{
try
{
// Use this method to receive the next message that arrives
// within the specified timeout interval.
// This call blocks until a message arrives, the timeout
// expires,
// or this message consumer is closed.
message = (TextMessage) qr.receive(1000);
if (message == null)
{
System.out.println("Keine Nachricht vorhanden!");
messageFound = true;