Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] deliveryComplete callback usage

Davy,

 

Looking at all of the MqttAsyncClient.publish() methods for the java API in the V1.0 jar file, it says that all of them return an IMqttDeliveryToken object.  Are these methods returning a null for you or are you just not setting them to anything?  Are you using V1.0 or an older version?  I typically haven’t used the async client so I’m not 100% sure how it works.

 

Also, the token in the deliveryComplete() method should NOT be empty.  It should contain the information that you are looking for so you can do your bookkeeping.  I use this method all the time just to simply log that the message was delivered.  You should be able to get the message ID from the token returned from the publish() method and then get that same message ID from the token passed into the deliveryComplete() method.

 

Dwayne

 

 

From: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-bounces@xxxxxxxxxxx] On Behalf Of Davy De Waele
Sent: Saturday, January 24, 2015 6:10 AM
To: paho-dev@xxxxxxxxxxx
Subject: [paho-dev] deliveryComplete callback usage

 



*** Exercise caution. This is an EXTERNAL email. DO NOT open attachments or click links from unknown senders or unexpected email. ***

Hi,

 

I had a couple of questions on the deliveryComplete callback.

 

public void deliveryComplete(IMqttDeliveryToken token) {}

 

How can we use this mechanism to do some message bookkeeping, in other words, keeping tabs on that messages have been delivered completely.

 

It is my understanding that upon succesfull delivery this token will be empty (the message already being discarded).

 

In that case, what can be done inside this callback ?

 

The DeliveryToken is also something that is not available after publish I guess, as the asyncClient doesn't return anything, and the token is not made available.

 

So how should one this  deliveryComplete callback and IMqttDeliveryToken object ?

 

Regards,

Davy


Back to the top