Open
Description
Expected behavior
The async client (in my case Mqtt3AsyncClient
) should not block when calling send
no matter what the client state is; instead I would expect to get the CompletableFuture<MqttPublish>
Actual behavior
send
blocks the calling thread; I guess waiting for the client to be in a connected state?
To Reproduce
- Create an Mqtt3AsyncClient with reconnect logic, put an invalid host value (so the client can never actually connect)
- Publish an MQTT message e.g.:
client.publishWith()
.topic(message.topic)
.payload(messageToBytes(message.payload))
.send()
.whenComplete((publish, throwable) -> {
if (throwable != null) {
// Failure
LOG.log(Level.INFO, "Failed to publish to MQTT broker '" + getClientUri() + "'", throwable);
} else {
// Success
LOG.finer("Published message to MQTT broker '" + getClientUri() + "'");
}
});
- Notice that the call blocks on the
send
call with noFuture
ever returned
Details
- Affected HiveMQ MQTT Client version(s): 1.2.2
- Used JVM version: Oracle JDK 17.0.1
- Used OS (name and version): Windows 10 64-bit but also same behaviour on Linux Debian AArch64
- Used MQTT version: N/A
- Used MQTT broker (name and version): N/A