hivemq-mqtt-client icon indicating copy to clipboard operation
hivemq-mqtt-client copied to clipboard

How to Handle Timeouts While Publishing a Message

Open teivah opened this issue 3 years ago • 2 comments

Expected behavior

I didn't know how to report it but I can't find in the documentation how to set up a timeout while publishing a message. Here, it's described while consuming messages but what about publishing?

So far, I've been using the Mqtt5BlockingClient:

client = builder.buildBlocking();
client.connect();

client.toAsync()
		.subscribeWith()
		.topicFilter(topic)
		.qos(qos)
		.callback(consumer)
		.send()
		.get();

// ...

client.publishWith()
		.topic(messageTopic)
		.payload(payload)
		.qos(messageQOS)
		.messageExpiryInterval(messageExpirySeconds)
		.send();

In this process, how can I attach a timeout, please?

Actual behavior

To Reproduce

Steps

Reproducer code

Details

  • Affected HiveMQ MQTT Client version(s):
  • Used JVM version:
  • Used OS (name and version):
  • Used MQTT version:
  • Used MQTT broker (name and version):

teivah avatar May 13 '21 13:05 teivah

Sorry for the delay, I will still answer here in the next few days, but unfortunately did not find the time in the last weeks.

SgtSilvio avatar Jun 04 '21 09:06 SgtSilvio

Hey @SgtSilvio, thanks for your answer. Any news, please?

teivah avatar Jun 17 '21 07:06 teivah

@teivah @SgtSilvio Did you figure out a method to specify a publish timeout? We are facing similar issue.

mat0pad avatar Aug 23 '23 08:08 mat0pad

I have the same question for MQTT3. I can't find anywhere how to set it.

outsideMyBox avatar Nov 09 '23 13:11 outsideMyBox