Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-2164

The MaximumPendingMessageLimit option is doesn't work in .Net

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 5.2.0
    • 5.3.0
    • JMS client
    • None
    • ActiveMQ 5.2, XP 64,NMS, NMS.ActiveMQ, vs2008 ,java1.6 ant build the activemq

    • Patch Available
    • Unit Test Broken

    Description

      I tried to test the MaximumPendingMessageLimit property in donet . But it doesn't work. i tried to setup it in Code, and ActiveMQ.XML ,it both doesn't work

      1. Create a durable consumer
      2. Create a producer and send message in topic (persistent send)
      3. Consumer get message and try to block the consumer speed. (speed is slow )
      4 Go to web console check the pendingmessage number
      The number should be keeping the maxpendingmessage number. My consumer is slow the producer is faster. But I found out the number is still grow.

      i will create another test poster and attach the test file in there
      http://www.nabble.com/pendingmessagelimit-option-seems-doesn%27t-work!-td22447336r0.html

      By the way there have another people test it , it also doesn't work for Java.
      http://www.nabble.com/Fast-producers%2Cslow-consumer...-queue-growing-forever-td22373306.html

      Thanks

      Sample code---- include connection, session, consumer and producer

      ---------
      public TopicConnection(IConnectionFactory connectionFactory, string clientId, string topicName)

      { this.connection = connectionFactory.CreateConnection() as Connection ; this.connection.ClientId = clientId; if (!this.connection.IsStarted) { this.connection.Start(); }

      this.session = this.connection.CreateSession(AcknowledgementMode.ClientAcknowledge) as Session;
      session.MaximumPendingMessageLimit = 10;
      session.PrefetchSize = 20;
      this.topic = new ActiveMQTopic(topicName);

      }
      -------------------------------

      ----- running another console to get message--
      IMessageConsumer consumer = this.session.CreateDurableConsumer(this.topic, consumerId, "2 > 1", false);
      consumer.Listener += new MessageListener(consumer_Listener);
      void consumer_Listener(IMessage message)
      {
      ActiveMQTextMessage msg = message as ActiveMQTextMessage; Console.WriteLine("Message received:" + "Id = " + msg.NMSMessageId + ", Content:" + msg.Text); Thread.sleep(1000);//block here message.Acknowledge();
      }

      ---- running another console to send message
      IMessageProducer producer = this.session.CreateProducer(this.topic);
      while (true)
      {
      publisher.SendMessage("Message:" + DateTime.Now.ToString("yyyy-mm-dd HH:MM:ss") + "---" + i.ToString() );
      }

      And both setup it into activemq.xml
      <destinationPolicy>
      <policyMap>
      <policyEntries>
      <policyEntry topic=">">
      <dispatchPolicy>
      <strictOrderDispatchPolicy />
      </dispatchPolicy>
      <pendingMessageLimitStrategy>
      <constantPendingMessageLimitStrategy limit="10"/>
      </pendingMessageLimitStrategy>

      </policyEntry>
      </policyEntries>
      </policyMap>
      </destinationPolicy

      Attachments

        1. Activemq.xml
          2 kB
          xinfang yuan
        2. ActiveMQPendingMessageTest.zip
          354 kB
          xinfang yuan

        Activity

          People

            tabish Timothy A. Bish
            pclovec xinfang yuan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: