Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Problem
-
1.7.2
-
None
-
None
Description
When following the example provided at https://activemq.apache.org/components/nms/examples/nms-simple-asynchronous-consumer-example, I find that the consumer asynchronous listener throws an error in every case. That is:
consumer.Listener += new MessageListener(OnMessage);
The error thrown is "Cannot set Async listeners on Consumers with a prefetch limit of zero". However, I have a prefetch limit that is not zero.
I tracked down some code at https://github.com/ThorTech/apache-nms/blob/master/Apache.NMS.ActiveMQ/1.5.0/src/main/csharp/MessageConsumer.cs which suggests that the function that handles receiving messages and checks for listeners always throws an exception:
private void CheckMessageListener()
{
if(this.listener != null)
{
throw new NMSException("Cannot set Async listeners on Consumers with a prefetch limit of zero");
}
}
I understand that this may not be the most up to date code, but it would explain why I am seeing this behavior. Are asynchronous consumers actually supported? This exception, clearly out of place, suggests not, or it is a bug and nobody has stumbled upon this behaviour before.