File tree Expand file tree Collapse file tree
org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1307,6 +1307,17 @@ public MqttMessage getBufferedMessage(int bufferIndex){
13071307 public void deleteBufferedMessage (int bufferIndex ){
13081308 this .comms .deleteBufferedMessage (bufferIndex );
13091309 }
1310+
1311+ /**
1312+ * Returns the current number of outgoing in-flight messages
1313+ * being sent by the client. Note that this number cannot be
1314+ * guaranteed to be 100% accurate as some messages may have
1315+ * been sent or queued in the time taken for this method to return.
1316+ * @return the current number of in-flight messages.
1317+ */
1318+ public int getInFlightMessageCount (){
1319+ return this .comms .getActualInFlight ();
1320+ }
13101321
13111322
13121323
Original file line number Diff line number Diff line change @@ -480,7 +480,9 @@ private void restoreInflightMessages() {
480480 public void send (MqttWireMessage message , MqttToken token ) throws MqttException {
481481 final String methodName = "send" ;
482482 if (message .isMessageIdRequired () && (message .getMessageId () == 0 )) {
483- message .setMessageId (getNextMessageId ());
483+ if (message instanceof MqttPublish && (((MqttPublish ) message ).getMessage ().getQos () != 0 )){
484+ message .setMessageId (getNextMessageId ());
485+ }
484486 }
485487 if (token != null ) {
486488 try {
You can’t perform that action at this time.
0 commit comments