Skip to main content

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

I was using the sync client (MqttClient) that delegates to MqttAsyncClient but doesn't return the token. I'm testing with the MqttAsyncClient now and will let you know how it goes.
The token is not empty but the Message in the token is null. I read somewhere that this is expected behaviour. I'll try to do the bookkeeping based on the messageID.

On Sat, Jan 24, 2015 at 6:39 PM, Bradley, Dwayne <Dwayne.Bradley@xxxxxxxxxxxxxxx> wrote:

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


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev


Back to the top