Send many publish message: Too many publishes in progress Error
<p>Here is paho Async client:</p>

<pre><code>    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();
        }
    });
</code></pre>

<p>Here I am sending messages in loop:</p>

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

<p>Error:</p>

<pre><code>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)
</code></pre>

<p>I am using <code>Rabbitmq</code></p>