Interface Mqtt5BlockingClient
- All Superinterfaces:
Mqtt5Client,MqttClient
Mqtt5Client.- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceResource which queues incoming Publish messages until they are received. -
Field Summary
Fields inherited from interface com.hivemq.client.mqtt.MqttClient
DEFAULT_SERVER_HOST, DEFAULT_SERVER_PORT, DEFAULT_SERVER_PORT_SSL, DEFAULT_SERVER_PORT_WEBSOCKET, DEFAULT_SERVER_PORT_WEBSOCKET_SSL -
Method Summary
Modifier and TypeMethodDescriptionconnect()Connects this client with the default Connect message.connect(@NotNull Mqtt5Connect connect) Connects this client with the given Connect message.Fluent counterpart ofconnect(Mqtt5Connect).voidDisconnects this client with the default Disconnect message.voiddisconnect(@NotNull Mqtt5Disconnect disconnect) Disconnects this client with the given Disconnect message.Fluent counterpart ofdisconnect(Mqtt5Disconnect).publish(@NotNull Mqtt5Publish publish) Publishes the given Publish message.publishes(@NotNull MqttGlobalPublishFilter filter) Globally consumes all incoming Publish messages matching the given filter.publishes(@NotNull MqttGlobalPublishFilter filter, boolean manualAcknowledgement) Globally consumes all incoming Publish messages matching the given filter.Fluent counterpart ofpublish(Mqtt5Publish).voidreauth()Re-authenticates this client.subscribe(@NotNull Mqtt5Subscribe subscribe) Subscribes this client with the given Subscribe message.Fluent counterpart ofsubscribe(Mqtt5Subscribe).default @NotNull Mqtt5BlockingClientTurns the API of this client into a blocking API.unsubscribe(@NotNull Mqtt5Unsubscribe unsubscribe) Unsubscribes this client with the given Unsubscribe message.Fluent counterpart ofunsubscribe(Mqtt5Unsubscribe).Methods inherited from interface com.hivemq.client.mqtt.mqtt5.Mqtt5Client
getConfig, toAsync, toRxMethods inherited from interface com.hivemq.client.mqtt.MqttClient
getState
-
Method Details
-
connect
Connects this client with the default Connect message.- Returns:
- see
connect(Mqtt5Connect). - See Also:
-
connect
Connects this client with the given Connect message.- Parameters:
connect- the Connect message sent to the broker.- Returns:
- the ConnAck message if it does not contain an Error Code (connected successfully).
- Throws:
Mqtt5ConnAckException- wrapping the ConnAck message if it contains an Error Code.
-
connectWith
Fluent counterpart ofconnect(Mqtt5Connect).Calling
Mqtt5ConnectBuilder.Send.send()on the returned builder has the same effect as callingconnect(Mqtt5Connect)with the result ofMqtt5ConnectBuilder.build().- Returns:
- the fluent builder for the Connect message.
- See Also:
-
subscribe
Subscribes this client with the given Subscribe message.See
publishes(MqttGlobalPublishFilter)to consume the incoming Publish messages.- Parameters:
subscribe- the Subscribe messages sent to the broker.- Returns:
- the SubAck message if all subscriptions of the Subscribe message were successful (the SubAck message contains no Error Codes).
- Throws:
Mqtt5SubAckException- wrapping the SubAck message if it contains at least one Error Code.
-
subscribeWith
Fluent counterpart ofsubscribe(Mqtt5Subscribe).Calling
Mqtt5SubscribeBuilder.Send.Complete.send()on the returned builder has the same effect as callingsubscribe(Mqtt5Subscribe)with the result ofMqtt5SubscribeBuilder.Complete.build().- Returns:
- the fluent builder for the Subscribe message.
- See Also:
-
publishes
@NotNull @NotNull Mqtt5BlockingClient.Mqtt5Publishes publishes(@NotNull @NotNull MqttGlobalPublishFilter filter) Globally consumes all incoming Publish messages matching the given filter.- Parameters:
filter- the filter with which all incoming Publish messages are filtered.- Returns:
- a
Mqtt5BlockingClient.Mqtt5Publishesinstance that can be used to receive the Publish messages on the calling thread. - See Also:
-
publishes
@NotNull @NotNull Mqtt5BlockingClient.Mqtt5Publishes publishes(@NotNull @NotNull MqttGlobalPublishFilter filter, boolean manualAcknowledgement) Globally consumes all incoming Publish messages matching the given filter.- Parameters:
filter- the filter with which all incoming Publish messages are filtered.manualAcknowledgement- whether the Publish messages are acknowledged manually.- Returns:
- a
Mqtt5BlockingClient.Mqtt5Publishesinstance that can be used to receive the Publish messages on the calling thread. - Since:
- 1.2
- See Also:
-
unsubscribe
Unsubscribes this client with the given Unsubscribe message.- Parameters:
unsubscribe- the Unsubscribe message sent to the broker.- Returns:
- the UnsubAck message if all Topic Filters of the Unsubscribe message were successfully unsubscribed (the UnsubAck message contains no Error Codes).
- Throws:
Mqtt5UnsubAckException- wrapping the UnsubAck message if it contains at least one Error Code.
-
unsubscribeWith
Fluent counterpart ofunsubscribe(Mqtt5Unsubscribe).Calling
Mqtt5UnsubscribeBuilder.Send.Complete.send()on the returned builder has the same effect as callingunsubscribe(Mqtt5Unsubscribe)with the result ofMqtt5UnsubscribeBuilder.Complete.build().- Returns:
- the fluent builder for the Unsubscribe message.
- See Also:
-
publish
Publishes the given Publish message.- Parameters:
publish- the Publish message sent to the broker.- Returns:
- the
Mqtt5PublishResultif the Publish message was successfully published (no acknowledgement message contains an Error Code,Mqtt5PublishResult.getError()will always be absent). - Throws:
Mqtt5PubAckException- wrapping the corresponding PubAck message if it contains an Error Code.Mqtt5PubRecException- wrapping the corresponding PubRec message if it contains an Error Code.
-
publishWith
Fluent counterpart ofpublish(Mqtt5Publish).Calling
Mqtt5PublishBuilder.Send.Complete.send()on the returned builder has the same effect as callingpublish(Mqtt5Publish)with the result ofMqtt5PublishBuilder.Complete.build().- Returns:
- the fluent builder for the Unsubscribe message.
- See Also:
-
reauth
void reauth()Re-authenticates this client.- Throws:
Mqtt5AuthException- wrapping the Auth message with the Error Code if not re-authenticated successfully.
-
disconnect
void disconnect()Disconnects this client with the default Disconnect message.- See Also:
-
disconnect
Disconnects this client with the given Disconnect message.- Parameters:
disconnect- the Disconnect message sent to the broker.
-
disconnectWith
Fluent counterpart ofdisconnect(Mqtt5Disconnect).Calling
Mqtt5DisconnectBuilder.SendVoid.send()on the returned builder has the same effect as callingdisconnect(Mqtt5Disconnect)with the result ofMqtt5DisconnectBuilder.build().- Returns:
- the fluent builder for the Unsubscribe message.
- See Also:
-
toBlocking
Description copied from interface:Mqtt5ClientTurns the API of this client into a blocking API.The blocking API can be used simultaneously with the other APIs.
- Specified by:
toBlockingin interfaceMqtt5Client- Returns:
- a blocking API for this client.
-