I have question about receiveNoWait method. When I use it, it always returns null
if I use this code: consumer.receive(2000) - everything is ok. I receive message.
if I use this code: consumer.receiveNoWait() - I do not receive any messages,
My program must check queue periodically, using quartz - so I don;t want to block process pointing any time to receive()
How can I make receiveNoWait() to return messages?
Hi, the receiveNoWait means it doesn't wait until a message is received. You can't expect it will get something every time you called it. If you can get a message by receive(2000), try to replace it with sleeping 2000 ms and call receiveNoWait(). I bet you will get the messages.