0

This snippet keeps looping through the queue browser. Apache.NMS 1.5.1, Apache.NMS.ActiveMQ 1.5.6, Broker 5.8.0

Queue size is < 200 I checked prefetch, and it is still at default.

ActiveMQ with C# and Apache NMS - Count messages in queue suggests checking enumerator.Current in the loop, but I am already doing that.

I tried setting a large prefetch with ?jms.prefetchPolicy.all=50000, but it still loops.

IConnectionFactory connectionFactory = new ConnectionFactory(connectUri, "SNDTest");
    using (IConnection conn = connectionFactory.CreateConnection(USERNAME, PASSWORD))
    {
        conn.Start();
        using (ISession session = conn.CreateSession())
        {
            using (IQueueBrowser browser = session.CreateBrowser(errorQueue))
                {
                    int i = 0;
                    var e = browser.GetEnumerator();
                    while (e.MoveNext())
                    {
                        i++;
                        IMessage m = e.Current as IMessage;

How do I stop the looping?

Community
  • 1
  • 1
slipsec
  • 3,004
  • 3
  • 34
  • 46

1 Answers1

0

This could be related to some bugs that are fixed in the v5.9.0 snapshot builds such as, AMQ-4487. Try downloading a recent nightly build of the broker and running against that.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42