activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Queue gets clogged in OpenWire.NET when using Listener
Date Sat, 05 Aug 2006 06:26:11 GMT
I wonder if this is some kind of acknowledgement bug in the
ActiveMQ.Net client. Incidentally are you using SVN trunk as I
remember patching some bug in this area recently.

If that doesn't fix it please raise a JIRA so we can track the issue

On 8/4/06, sparky2708 <daa82@columbia.edu> wrote:
>
> For one of the tests that I am doing I have an OpenWire.NET producer and
> consumer that runs within Excel using a C# COM object to access ActiveMQ
> using OpenWire.NET. It sends messages and then immediately consumes them.
> When Excel quits on me I see that the messages get stuck on the queue
> (through jconsole). When I restart Excel and res-subscribe my client I don't
> get any messages even though messages are sitting on the queue. So my
> OpenWire.NET code looks like (assume enable_async_receive is true):
>
>  public void CreateConnection(string url)
>             {
>                 IConnectionFactory factory = new ConnectionFactory(new
> Uri(url));
>                 _jms_conn = factory.CreateConnection();
>                 Console.WriteLine("Created a connection!");
>                 _jms_session = _jms_conn.CreateSession();
>                 Console.WriteLine("Session started!");
>             }
>
>  public void Subscribe(string queue, bool enable_async_receive)
>             {
>                 IDestination destination = _jms_session.GetQueue(queue);
>                 Console.WriteLine("Using destination: " + destination);
>
>                 // lets create a consumer and producer
>                 _consumer = _jms_session.CreateConsumer(destination);
>                 if (enable_async_receive)
>                     _consumer.Listener += new
> MessageListener(_consumer_Listener);
>
>                 _producer = _jms_session.CreateProducer(destination);
>                 _producer.Persistent = false;
>             }
>
>
>  void _consumer_Listener(IMessage message)
>             {
>                 lock (this)
>                 {
>                     OnMessageReceived(((ITextMessage)message).Text);
>                 }
>             }
>
>   public string Receive()
>             {
>                 IMessage message = _consumer.Receive();
>                 if (message == null)
>                     return null;
>                 else
>                     return ((ITextMessage) message).Text;
>             }
>
> By trial and error I found out if I call the Receive() method above I seem
> to unclog the queue and my event listener kicks back in. Any idea why this
> happens?
>
> P.S.: The provided example java consumer doesn't seem to have any problem
> getting messages from the queue because I think it also just calls Receive()
> a number of times and doesn't use a listener.
>
>
>
> --
> View this message in context: http://www.nabble.com/Queue-gets-clogged-in-OpenWire.NET-when-using-Listener-tf2051829.html#a5652526
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message