[ 
https://issues.apache.org/jira/browse/AMQNET-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824377#comment-16824377
 ] 

Timothy Bish commented on AMQNET-584:
-------------------------------------

It isn't entirely clear from you description what you are doing but a quick 
look at the code would indicate that the error message in CheckMessageListener 
is not correct but the fact that it throws is correct.  You cannot call the 
synchronous receive methods when there is an asynchronous listener registered. 

> CheckMessageListener throws error when any listener exists
> ----------------------------------------------------------
>
>                 Key: AMQNET-584
>                 URL: https://issues.apache.org/jira/browse/AMQNET-584
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: NMS
>    Affects Versions: 1.7.2
>            Reporter: Joshua Ingham
>            Priority: Major
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to