I have the MQConsumerClass that retrieves the messages from the queue as follows.
while (running)
{
try
{
MQMessage rcvMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQConstants.MQGMO_WAIT;
gmo.waitInterval = 60000;
queue.get(rcvMessage, gmo);
if(rcvMessage.getTotalMessageLength() > 0)
{
String msgText = rcvMessage.readUTF();
}
}
catch blocks{}
}
But the problem is when there is no message in the queue, the 2033 exception is thrown.
I think 2033 NO_MSG_AVAILABLE exception is NOT serious exception that probably can stop the operation.
However, I want to call onMessage(Message msg)
function whenever there is a new message in the queue.
I want to create this class with MessageListener but I cannot find MessageListener or any example related to it.
So, please tell me if there is any MessageListener function in WMQ Java API.
or
any way to do this?