|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Provides a mechanism for tracking the delivery of messages.
Calls to MqttTopic.publish(MqttMessage)
return after the message has been sent, but do not wait for acknowledgements
to be received. This allows the
client to have multiple messages in-flight at one time.
In order to track the delivery of a message, those methods
return an instance of this class which can be used in one of two ways:
waitForCompletion()
to block the current thread
until delivery has completedMqttCallback
.
Method Summary | |
---|---|
MqttMessage |
getMessage()
Returns the message associated with this token, or null if the message has
already been successfully sent. |
boolean |
isComplete()
Returns whether or not the delivery has finished. |
void |
waitForCompletion()
Blocks the current thread until the message this is the token for completes delivery. |
void |
waitForCompletion(long timeout)
Blocks the current thread until the message this is the token for completes delivery. |
Method Detail |
public void waitForCompletion() throws MqttException, MqttSecurityException
MqttException
- if there was a problem completing delivery of the message.
MqttSecurityException
public void waitForCompletion(long timeout) throws MqttException, MqttSecurityException
isComplete()
method can be used to determine if the delivery is
complete, or if the wait has timed out.
timeout
- the maximum amount of time to wait for, in milliseconds.
MqttException
- if there was a problem completing delivery of the message
MqttSecurityException
public boolean isComplete()
public MqttMessage getMessage() throws MqttException
null
if the message has
already been successfully sent.
MqttException
- if there was a problem completing retrieving the message
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |