Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Java mqtt "too many publishes in progress" issue.


Hi All,

Thanks for your all development projects in advance.

Our project is currently use java mqtt broker, the issue now was when the server-----producing application (publisher) ,publishes the message to clients. If there is certain amount of clients (around 20), the error "too many publishes in progress" will come out even I manually set the max_in_flight value to 100.


Do not if I wrote correct code on the server side.Below was the code that I publish the message from the server to the clients.

public synchronized void send(Packet packet) {

if(_mqttClient == null || _mqttClient.isConnected() == false) {
_worker.log(TAG"Error: mqtt client offline.");
return;
}

try {
MqttTopic topic = _mqttClient.getTopic(packet.getTopicName());
String msg = packet.getMessage();
MqttMessage message = new MqttMessage(msg.getBytes());
message.setQos(2);

msg = Packet.logify(msg, packet._type, packet.getToken());
_worker.log(TAG"<mqtt-snd topic='" + topic.getName() + "'>" + msg + "</mqtt-snd>");
topic.publish(message);
/*MqttDeliveryToken resp = */
/*resp.waitForCompletion(10000);*/
}
catch (MqttException exception) {
_worker.log(TAG, exception.getMessage());
_worker.log(TAG"Error: mqtt send packet failed: < " + packet.getMessage() + " >");
catch (Exception e) {
e.printStackTrace();
}
}






Regards,
 
Jianing Ren
Software Developer
 





 
p: +61 2 9281 0444
mobile: +61 (0)488037723
a: ADTEC Communications. Suite13, 89-97 Jones street, Ultimo NSW Australia 2007
ADTEC Communications is a 100% Australian owned critical communications, voice, video and data conferencing specialist.
This e-mail may contain confidential information. If you are not the intended recipient do not keep, forward, use, save or reply to this communication






This email has been processed by SmoothZap - www.smoothwall.net


Back to the top