Skip to content

TTL for Max Inflight Message queue in V1 SDK and V2 SDK #332

Answered by TwistedTwigleg
mogambo100 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mogambo100,

You can set a timeout for operations in the Java V1 and V2 SDKs to avoid the issue where the server is down and therefore operations just sit in the queue.


For Java V1, you can do something like the following on a per operation basis:

long timeout = 3000;  // milliseconds
client.publish(message, timeout);

All operations can have a timeout associated with them, as described in the Java V1 Readme. This will prevent the operations from just sitting in the queue endless waiting.


For Java V2, a timeout can be applied on a per-operation basis using the following:

CompletableFuture<Integer> published = connection.publish(new MqttMessage(topic, message.getBytes(), QualityOfServ…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by mogambo100
Comment options

You must be logged in to vote
1 reply
@TwistedTwigleg
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants