Package com.hivemq.client.mqtt.mqtt5
Interface Mqtt5BlockingClient.Mqtt5Publishes
- All Superinterfaces:
AutoCloseable
- Enclosing interface:
Mqtt5BlockingClient
Resource which queues incoming Publish messages until they are received.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()receive()Receives the next incoming Publish message.Receives the next incoming Publish message.Receives the next incoming Publish message if it is already queued in thisMqtt5BlockingClient.Mqtt5Publishesinstance.
-
Method Details
-
receive
Receives the next incoming Publish message.- Might return immediately if there is already a Publish message queued in this
Mqtt5BlockingClient.Mqtt5Publishesinstance. - Otherwise blocks the calling thread until a Publish message is received.
- Returns:
- the received Publish message.
- Throws:
InterruptedException- if the calling thread is interrupted while waiting for a Publish message to be received.
- Might return immediately if there is already a Publish message queued in this
-
receive
@NotNull @NotNull Optional<Mqtt5Publish> receive(long timeout, @NotNull @NotNull TimeUnit timeUnit) throws InterruptedException Receives the next incoming Publish message.- Might return immediately if there is already a Publish message queued in this
Mqtt5BlockingClient.Mqtt5Publishesinstance. - Otherwise blocks the calling thread until a Publish message is received or the given timeout applies.
- Parameters:
timeout- the time to wait for a Publish messages to be received.timeUnit- the time unit of the timeout parameter.- Returns:
- an
Optionalcontaining the received Publish message, or empty if no Publish message was received in the given timeout period. - Throws:
InterruptedException- if the calling thread is interrupted while waiting for a Publish message to be received.
- Might return immediately if there is already a Publish message queued in this
-
receiveNow
Receives the next incoming Publish message if it is already queued in thisMqtt5BlockingClient.Mqtt5Publishesinstance.- Returns:
- an
Optionalcontaining the already queued Publish message, or empty if no Publish message was already queued.
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-