You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Petr Postulka <pe...@email.cz> on 2010/06/09 00:16:30 UTC

maximum of 9999 messages received from the exchange

Hello All,

I have just started to do some tests with Apache Qpid and i have run into a problem with maximum number of messages, which can be received by the subscriber.

I am using a C++ broker under Windows 7 and C# client libraries in my test application. If I am sending small amount of messages, everything is working fine, but when i tried to increase the number of messages to more than 9999, I receive only 9999 messages and no more. After the consumer is restarted I receive another 9999 messages and it stops receiving again. Can someone tell me, what I am doing wrong? It seems that there is some limit, but I can not find where. I have found properties like qpid.max_size and qpid.max_count, which can be set on QueueDeclare method, but whether I put there some big number or not, the behavior is still same, only 9999 messages at maximum are received. However if I set qpid.max_count=10, it behaves correctly, only 10 messages are queued and next messages are rejected. So it seems, that this parameter does not influence the strange behavior.

 Here is the main part of implementation of my publisher:

        public void Start()
        {
            session = connection.CreateSession(500000);
            session.ExchangeDeclare(configuration.ExchangeName, configuration.ExchangeType, String.Empty, null, Option.DURABLE); 
        }

        public void SendMessage(string routingKey, byte[] message)
        {
            IMessage messageToSent = new Message();
            messageToSent.DeliveryProperties.SetDeliveryMode(MessageDeliveryMode.PERSISTENT);
            messageToSent.DeliveryProperties.SetRoutingKey(routingKey);
            messageToSent.AppendData(message);
            session.MessageTransfer(configuration.ExchangeName, messageToSent); 
        }

        public void Stop()
        {
            session.Close(); 
        }

And here is the main part of implementation of my subsriber: 

        public void Start()
        {
            session = connection.CreateSession(50000);
            session.ExchangeDeclare(configuration.ExchangeName, configuration.ExchangeType, String.Empty, null , Option.DURABLE);
            session.QueueDeclare(configuration.QueueName, String.Empty, new Dictionary<string, object>() {{ "qpid.policy_type", "reject" }}, Option.DURABLE); 
            session.ExchangeBind(configuration.QueueName, configuration.ExchangeName, configuration.RoutingKey); 
            session.AttachMessageListener(this, configuration.QueueName);
            session.MessageSubscribe(configuration.QueueName); 
        }

        public void Stop()
        {
            session.Close();
        }

        #region Implementation of IMessageListener

        public void MessageTransfer(IMessage message)
        {
            BinaryReader reader = new BinaryReader(message.Body, Encoding.UTF8);
            byte[] messageBody = new byte[message.Body.Length - message.Body.Position];
            reader.Read(messageBody, 0, messageBody.Length);

            Console.WriteLine(message.Id);

            session.MessageAccept(new RangeSet() { message.Id });

            if (OnMessageReceived != null)
                OnMessageReceived(identifier, messageBody);
        }


I would be very glad if someone can point me to right direction how to remove the 9999 message limit.

Thanks a lot in advance.

Kind regards,

Petr



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Re: maximum of 9999 messages received from the exchange

Posted by Petr Postulka <pe...@email.cz>.
Thank you very much Rajith,

I will try today evening and let you know if it helps.

Can I ask, what markCompleted method does?

Thank you and kind regards,

Petr

> ------------ Původní zpráva ------------
> Od: Rajith Attapattu <ra...@gmail.com>
> Předmět: Re: maximum of 9999 messages received from the exchange
> Datum: 09.6.2010 17:27:43
> ----------------------------------------
> try doing session.markCompleted(new RangeSet() { message.Id }, true)
> just after session.MessageAccept(new RangeSet() { message.Id });
> 
> Rajith
> 
> On Tue, Jun 8, 2010 at 6:16 PM, Petr Postulka <pe...@email.cz> wrote:
> > Hello All,
> >
> > I have just started to do some tests with Apache Qpid and i have run into a
> problem with maximum number of messages, which can be received by the
> subscriber.
> >
> > I am using a C++ broker under Windows 7 and C# client libraries in my test
> application. If I am sending small amount of messages, everything is working
> fine, but when i tried to increase the number of messages to more than 9999, I
> receive only 9999 messages and no more. After the consumer is restarted I
> receive another 9999 messages and it stops receiving again. Can someone tell me,
> what I am doing wrong? It seems that there is some limit, but I can not find
> where. I have found properties like qpid.max_size and qpid.max_count, which can
> be set on QueueDeclare method, but whether I put there some big number or not,
> the behavior is still same, only 9999 messages at maximum are received. However
> if I set qpid.max_count=10, it behaves correctly, only 10 messages are queued
> and next messages are rejected. So it seems, that this parameter does not
> influence the strange behavior.
> >
> >  Here is the main part of implementation of my publisher:
> >
> >        public void Start()
> >        {
> >            session = connection.CreateSession(500000);
> >            session.ExchangeDeclare(configuration.ExchangeName,
> configuration.ExchangeType, String.Empty, null, Option.DURABLE);
> >        }
> >
> >        public void SendMessage(string routingKey, byte[] message)
> >        {
> >            IMessage messageToSent = new Message();
> >          
>  messageToSent.DeliveryProperties.SetDeliveryMode(MessageDeliveryMode.PERSISTENT);
> >            messageToSent.DeliveryProperties.SetRoutingKey(routingKey);
> >            messageToSent.AppendData(message);
> >            session.MessageTransfer(configuration.ExchangeName,
> messageToSent);
> >        }
> >
> >        public void Stop()
> >        {
> >            session.Close();
> >        }
> >
> > And here is the main part of implementation of my subsriber:
> >
> >        public void Start()
> >        {
> >            session = connection.CreateSession(50000);
> >            session.ExchangeDeclare(configuration.ExchangeName,
> configuration.ExchangeType, String.Empty, null , Option.DURABLE);
> >            session.QueueDeclare(configuration.QueueName, String.Empty, new
> Dictionary<string, object>() {{ "qpid.policy_type", "reject" }},
> Option.DURABLE);
> >            session.ExchangeBind(configuration.QueueName,
> configuration.ExchangeName, configuration.RoutingKey);
> >            session.AttachMessageListener(this, configuration.QueueName);
> >            session.MessageSubscribe(configuration.QueueName);
> >        }
> >
> >        public void Stop()
> >        {
> >            session.Close();
> >        }
> >
> >        #region Implementation of IMessageListener
> >
> >        public void MessageTransfer(IMessage message)
> >        {
> >            BinaryReader reader = new BinaryReader(message.Body,
> Encoding.UTF8);
> >            byte[] messageBody = new byte[message.Body.Length -
> message.Body.Position];
> >            reader.Read(messageBody, 0, messageBody.Length);
> >
> >            Console.WriteLine(message.Id);
> >
> >            session.MessageAccept(new RangeSet() { message.Id });
> >
> >            if (OnMessageReceived != null)
> >                OnMessageReceived(identifier, messageBody);
> >        }
> >
> >
> > I would be very glad if someone can point me to right direction how to remove
> the 9999 message limit.
> >
> > Thanks a lot in advance.
> >
> > Kind regards,
> >
> > Petr
> >
> >
> >
> > ---------------------------------------------------------------------
> > Apache Qpid - AMQP Messaging Implementation
> > Project:      http://qpid.apache.org
> > Use/Interact: mailto:users-subscribe@qpid.apache.org
> >
> >
> 
> 
> 
> -- 
> Regards,
> 
> Rajith Attapattu
> Red Hat
> http://rajith.2rlabs.com/
> 
> 
> 

Petr Postulka


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: maximum of 9999 messages received from the exchange

Posted by Rajith Attapattu <ra...@gmail.com>.
try doing session.markCompleted(new RangeSet() { message.Id }, true)
just after session.MessageAccept(new RangeSet() { message.Id });

Rajith

On Tue, Jun 8, 2010 at 6:16 PM, Petr Postulka <pe...@email.cz> wrote:
> Hello All,
>
> I have just started to do some tests with Apache Qpid and i have run into a problem with maximum number of messages, which can be received by the subscriber.
>
> I am using a C++ broker under Windows 7 and C# client libraries in my test application. If I am sending small amount of messages, everything is working fine, but when i tried to increase the number of messages to more than 9999, I receive only 9999 messages and no more. After the consumer is restarted I receive another 9999 messages and it stops receiving again. Can someone tell me, what I am doing wrong? It seems that there is some limit, but I can not find where. I have found properties like qpid.max_size and qpid.max_count, which can be set on QueueDeclare method, but whether I put there some big number or not, the behavior is still same, only 9999 messages at maximum are received. However if I set qpid.max_count=10, it behaves correctly, only 10 messages are queued and next messages are rejected. So it seems, that this parameter does not influence the strange behavior.
>
>  Here is the main part of implementation of my publisher:
>
>        public void Start()
>        {
>            session = connection.CreateSession(500000);
>            session.ExchangeDeclare(configuration.ExchangeName, configuration.ExchangeType, String.Empty, null, Option.DURABLE);
>        }
>
>        public void SendMessage(string routingKey, byte[] message)
>        {
>            IMessage messageToSent = new Message();
>            messageToSent.DeliveryProperties.SetDeliveryMode(MessageDeliveryMode.PERSISTENT);
>            messageToSent.DeliveryProperties.SetRoutingKey(routingKey);
>            messageToSent.AppendData(message);
>            session.MessageTransfer(configuration.ExchangeName, messageToSent);
>        }
>
>        public void Stop()
>        {
>            session.Close();
>        }
>
> And here is the main part of implementation of my subsriber:
>
>        public void Start()
>        {
>            session = connection.CreateSession(50000);
>            session.ExchangeDeclare(configuration.ExchangeName, configuration.ExchangeType, String.Empty, null , Option.DURABLE);
>            session.QueueDeclare(configuration.QueueName, String.Empty, new Dictionary<string, object>() {{ "qpid.policy_type", "reject" }}, Option.DURABLE);
>            session.ExchangeBind(configuration.QueueName, configuration.ExchangeName, configuration.RoutingKey);
>            session.AttachMessageListener(this, configuration.QueueName);
>            session.MessageSubscribe(configuration.QueueName);
>        }
>
>        public void Stop()
>        {
>            session.Close();
>        }
>
>        #region Implementation of IMessageListener
>
>        public void MessageTransfer(IMessage message)
>        {
>            BinaryReader reader = new BinaryReader(message.Body, Encoding.UTF8);
>            byte[] messageBody = new byte[message.Body.Length - message.Body.Position];
>            reader.Read(messageBody, 0, messageBody.Length);
>
>            Console.WriteLine(message.Id);
>
>            session.MessageAccept(new RangeSet() { message.Id });
>
>            if (OnMessageReceived != null)
>                OnMessageReceived(identifier, messageBody);
>        }
>
>
> I would be very glad if someone can point me to right direction how to remove the 9999 message limit.
>
> Thanks a lot in advance.
>
> Kind regards,
>
> Petr
>
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>



-- 
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org