Test Message Errors

Hi All,

I am sending a string message to MQ and trying to receive the message asysnchronously using amessage listerner.. My problems are:

1. I cannot initialize the Listener and 2. I cannot validate the message when I try to receive synchronously as atext message. My code for the assynchorous.

try{

qConnection= getConnection(HOST_NAME, QUEUE_MANAGER, PORT, CHANNEL_NAME);

qRecvSession = qConnection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);

mReceiveQueue =qRecvSession.createQueue(REPLY_QUEUE_NAME);

qReceiver= qRecvSession.createReceiver(mReceiveQueue);

System.out.println("Initialize Listener");

TextListener mListener =new TextListener();

System.out.println("After Initialize Listener... ");

qReceiver.setMessageListener(mListener);

qConnection.start();

System.out.println("Finished !!!");

}catch (JMSException e){ System.out.println("Exception occurred: " + e.toString());}

finally{

if (qConnection !=null){

try{

qConnection.close();

}catch (JMSException e){}

}

}

This is the message listener

publicclass TextListenerimplements MessageListener{

publicvoid onMessage(Message message){

TextMessage msg =null;

try{

if (messageinstanceof TextMessage){

msg = (TextMessage) message;

System.out.println("Reading message: " + msg.getText());

}else{

System.out.println("Message is not a TextMessage");

}

}catch (JMSException e){

System.out.println("JMSException in onMessage(): " + e.toString());

}catch (Throwable t){

System.out.println("Exception in onMessage():" + t.getMessage());

}

}

}

Can anybody help me please?

[3345 byte] By [Korigada] at [2007-11-26 13:18:32]
# 1
It's difficult to say what is the problem since you did not post any errors that I presume you're getting. Your code looks all right.
one9966a at 2007-7-7 17:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...