Send many publish message: Too many publishes in progress Error

1,048 views
Skip to first unread message

manish

unread,
Aug 3, 2016, 3:12:50 PM8/3/16
to rabbitmq-users
Here is paho Asyn client:

        client = new MqttAsyncClient(appProps.getProperty("mqtt.broker"),
                appProps.getProperty("mqtt.clientId"), new MemoryPersistence());
        client.setCallback(this);
        client.connect(null, new IMqttActionListener() {
            @Override
            public void onSuccess(IMqttToken imt) {
                try {
                    client.subscribe(Constants.internalTopics, Constants.internalTopicQOS);
                } catch (MqttException ex) {
                    ex.printStackTrace();
                }
            }

            @Override
            public void onFailure(IMqttToken imt, Throwable thrwbl) {
                thrwbl.printStackTrace();
            }
        });

Hre i am sending message in loop:

            while (iterator.hasNext()) {
                try {
                   client.publish("user/" + userId + "/downstream", mqttMessage);
                } catch(Exception ex) {
                    ex.printStackTrace();
                }
            }

Error:

    Too many publishes in progress (32202)
    at org.eclipse.paho.client.mqttv3.internal.ClientState.send(ClientState.java:436)
    at org.eclipse.paho.client.mqttv3.internal.ClientComms.internalSend(ClientComms.java:121)
    at org.eclipse.paho.client.mqttv3.internal.ClientComms.sendNoWait(ClientComms.java:139)
    at org.eclipse.paho.client.mqttv3.MqttAsyncClient.publish(MqttAsyncClient.java:858)
    at org.eclipse.paho.client.mqttv3.MqttAsyncClient.publish(MqttAsyncClient.java:836)

I am using `Rabbitmq`

Michael Klishin

unread,
Aug 3, 2016, 3:15:57 PM8/3/16
to rabbitm...@googlegroups.com
The error comes from the Paho client, not RabbitMQ.

RabbitMQ blocks
publishers by applying TCP back pressure if consumers cannot keep up with publishers,
however, this is not communicated to MQTT clients because there is no provisioning
in the protocol for arbitrary server-sent notifications or errors.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

manish kumar

unread,
Aug 3, 2016, 3:25:59 PM8/3/16
to rabbitm...@googlegroups.com

So what is the solution for to send 1000 messages.if a new comments comes and i hv to notify to all other user so the solution dat i found was to send message to every user's /notification topic.


You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/wCmBuwtl5dE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.

V Z

unread,
Aug 3, 2016, 8:23:37 PM8/3/16
to rabbitmq-users
You have to be checking the in-flight buffer, and if it's getting close to full then slow down your producer (using Thread.sleep() or something else).

It would help if Pivotal looked into MQTT plug-in performance (it's a quarter of AMQP throughput).

manish

unread,
Aug 4, 2016, 1:40:37 AM8/4/16
to rabbitmq-users
It would help if Pivotal looked into MQTT plug-in performance (it's a quarter of AMQP throughput).

Using Rabbitmq java driver will solve this issue or its just a generic issue? 

Michael Klishin

unread,
Aug 4, 2016, 9:47:54 AM8/4/16
to rabbitm...@googlegroups.com
Manish,

What specifically are you referring to as "this issue"?

On Wed, Aug 3, 2016 at 10:40 PM, manish <mkj.o...@gmail.com> wrote:
It would help if Pivotal looked into MQTT plug-in performance (it's a quarter of AMQP throughput).

Using Rabbitmq java driver will solve this issue or its just a generic issue? 

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

manish

unread,
Aug 4, 2016, 11:49:10 AM8/4/16
to rabbitmq-users
Too many publishes in progress (32202)

Using RabbitMq java driver can overcome this error

Michael Klishin

unread,
Aug 4, 2016, 11:51:44 AM8/4/16
to rabbitm...@googlegroups.com
We've previously established that the limit comes from the client library you use.
Using it will help because RabbitMQ Java client doesn't do rate limiting
but if consumers cannot keep up with publishers, RabbitMQ will throttle them.

RabbitMQ Java client implements a different protocol, so it's not really an
apples to apples comparison.

On Thu, Aug 4, 2016 at 8:49 AM, manish <mkj.o...@gmail.com> wrote:
Too many publishes in progress (32202)

Using RabbitMq java driver can overcome this error

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages