Interface Mqtt5RxClient
- All Superinterfaces:
Mqtt5Client,MqttClient
Mqtt5Client.- Since:
- 1.0
-
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()Creates aSinglefor connecting this client with the default Connect message.connect(@NotNull Mqtt5Connect connect) Creates aSinglefor connecting this client with the given Connect message.Fluent counterpart ofconnect(Mqtt5Connect).Creates aCompletablefor disconnecting this client with the default Disconnect message.disconnect(@NotNull Mqtt5Disconnect disconnect) Creates aCompletablefor disconnecting this client with the given Disconnect message.Fluent counterpart ofdisconnect(Mqtt5Disconnect).publish(@NotNull Flowable<Mqtt5Publish> publishFlowable) publishes(@NotNull MqttGlobalPublishFilter filter) Creates aFlowablefor globally consuming all incoming Publish messages matching the given filter.publishes(@NotNull MqttGlobalPublishFilter filter, boolean manualAcknowledgement) Creates aFlowablefor globally consuming all incoming Publish messages matching the given filter.reauth()Creates aCompletablefor re-authenticating this client.subscribe(@NotNull Mqtt5Subscribe subscribe) Creates aSinglefor subscribing this client with the given Subscribe message.subscribePublishes(@NotNull Mqtt5Subscribe subscribe) Creates aFlowableWithSinglefor subscribing this client with the given Subscribe message.subscribePublishes(@NotNull Mqtt5Subscribe subscribe, boolean manualAcknowledgement) Creates aFlowableWithSinglefor subscribing this client with the given Subscribe message.Fluent counterpart ofsubscribePublishes(Mqtt5Subscribe, boolean).subscribeStream(@NotNull Mqtt5Subscribe subscribe) Deprecated.Deprecated.Fluent counterpart ofsubscribe(Mqtt5Subscribe).default @NotNull Mqtt5RxClienttoRx()Turns the API of this client into a reactive API.unsubscribe(@NotNull Mqtt5Unsubscribe unsubscribe) Creates aSinglefor unsubscribing this client with the given Unsubscribe message.Fluent counterpart ofunsubscribe(Mqtt5Unsubscribe).Methods inherited from interface com.hivemq.client.mqtt.mqtt5.Mqtt5Client
getConfig, toAsync, toBlockingMethods inherited from interface com.hivemq.client.mqtt.MqttClient
getState
-
Method Details
-
connect
Creates aSinglefor connecting this client with the default Connect message.- Returns:
- see
connect(Mqtt5Connect). - See Also:
-
connect
@CheckReturnValue @NotNull @NotNull Single<Mqtt5ConnAck> connect(@NotNull @NotNull Mqtt5Connect connect) Creates aSinglefor connecting this client with the given Connect message.The returned
Singlerepresents the source of the ConnAck message corresponding to the given Connect message. Calling this method does not connect yet. Connecting is performed lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returnedSingle.- Parameters:
connect- the Connect message sent to the broker during connect.- Returns:
- the
Singlewhich- succeeds with the ConnAck message if it does not contain an Error Code (connected successfully),
- errors with a
Mqtt5ConnAckExceptionwrapping the ConnAck message if it contains an Error Code or - errors with a different exception if an error occurred before the Connect message was sent or before the ConnAck message was received.
-
connectWith
Fluent counterpart ofconnect(Mqtt5Connect).Calling
Mqtt5ConnectBuilder.Nested.applyConnect()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
@CheckReturnValue @NotNull @NotNull Single<Mqtt5SubAck> subscribe(@NotNull @NotNull Mqtt5Subscribe subscribe) Creates aSinglefor subscribing this client with the given Subscribe message.The returned
Singlerepresents the source of the SubAck message corresponding to the given Subscribe message. Calling this method does not subscribe yet. Subscribing is performed lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returnedSingle.See
publishes(MqttGlobalPublishFilter)to consume the incoming Publish messages. Alternatively, callsubscribePublishes(Mqtt5Subscribe)to consume the incoming Publish messages matching the subscriptions of the Subscribe message directly.- Parameters:
subscribe- the Subscribe message sent to the broker during subscribe.- Returns:
- the
Singlewhich- succeeds with the SubAck message if at least one subscription of the Subscribe message was successful (the SubAck message contains at least one Reason Code that is not an Error Code),
- errors with a
Mqtt5SubAckExceptionwrapping the SubAck message if it only contains Error Codes or - errors with a different exception if an error occurred before the Subscribe message was sent or before a SubAck message was received.
-
subscribeWith
Fluent counterpart ofsubscribe(Mqtt5Subscribe).Calling
Mqtt5SubscribeBuilder.Nested.Complete.applySubscribe()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:
-
subscribeStream
@Deprecated @NotNull @NotNull FlowableWithSingle<Mqtt5Publish,Mqtt5SubAck> subscribeStream(@NotNull @NotNull Mqtt5Subscribe subscribe) Deprecated.- Parameters:
subscribe- usesubscribePublishes(Mqtt5Subscribe).- Returns:
- use
subscribePublishes(Mqtt5Subscribe).
-
subscribeStreamWith
@Deprecated @NotNull Mqtt5SubscribeBuilder.Nested.Start<FlowableWithSingle<Mqtt5Publish,Mqtt5SubAck>> subscribeStreamWith()Deprecated.- Returns:
- use
subscribePublishesWith().
-
subscribePublishes
@CheckReturnValue @NotNull @NotNull FlowableWithSingle<Mqtt5Publish,Mqtt5SubAck> subscribePublishes(@NotNull @NotNull Mqtt5Subscribe subscribe) Creates aFlowableWithSinglefor subscribing this client with the given Subscribe message.The returned
FlowableWithSinglerepresents the source of the SubAck message corresponding to the given Subscribe message and the source of the incoming Publish messages matching the subscriptions of the Subscribe message. Calling this method does not subscribe yet. Subscribing is performed lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returnedFlowableWithSingle.- Parameters:
subscribe- the Subscribe message sent to the broker during subscribe.- Returns:
- the
FlowableWithSinglewhich- emits the SubAck message as the single and first element if at least one subscription of the Subscribe message was successful (the SubAck message contains at least one Reason Code that is not an Error Code) and then emits the Publish messages matching the successful subscriptions of the Subscribe message,
- completes when all subscriptions of the Subscribe message were unsubscribed,
- errors with a
Mqtt5SubAckExceptionwrapping the SubAck message if it only contains Error Codes or - errors with a different exception if an error occurred before the Subscribe message was sent,
before a SubAck message was received or when a error occurs before all subscriptions of the Subscribe
message were unsubscribed (e.g.
MqttSessionExpiredException).
- Since:
- 1.2
- See Also:
-
subscribePublishes
@CheckReturnValue @NotNull @NotNull FlowableWithSingle<Mqtt5Publish,Mqtt5SubAck> subscribePublishes(@NotNull @NotNull Mqtt5Subscribe subscribe, boolean manualAcknowledgement) Creates aFlowableWithSinglefor subscribing this client with the given Subscribe message.The returned
FlowableWithSinglerepresents the source of the SubAck message corresponding to the given Subscribe message and the source of the incoming Publish messages matching the subscriptions of the Subscribe message. Calling this method does not subscribe yet. Subscribing is performed lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returnedFlowableWithSingle.- Parameters:
subscribe- the Subscribe message sent to the broker during subscribe.manualAcknowledgement- whether the Publish messages are acknowledged manually.- Returns:
- the
FlowableWithSinglewhich- emits the SubAck message as the single and first element if at least one subscription of the Subscribe message was successful (the SubAck message contains at least one Reason Code that is not an Error Code) and then emits the Publish messages matching the successful subscriptions of the Subscribe message,
- completes when all subscriptions of the Subscribe message were unsubscribed,
- errors with a
Mqtt5SubAckExceptionwrapping the SubAck message if it only contains Error Codes or - errors with a different exception if an error occurred before the Subscribe message was sent,
before a SubAck message was received or when a error occurs before all subscriptions of the Subscribe
message were unsubscribed (e.g.
MqttSessionExpiredException).
- Since:
- 1.2
- See Also:
-
subscribePublishesWith
@CheckReturnValue @NotNull Mqtt5SubscribeBuilder.Publishes.Start<FlowableWithSingle<Mqtt5Publish,Mqtt5SubAck>> subscribePublishesWith()Fluent counterpart ofsubscribePublishes(Mqtt5Subscribe, boolean).Calling
Mqtt5SubscribeBuilder.Nested.Complete.applySubscribe()on the returned builder has the same effect as callingsubscribePublishes(Mqtt5Subscribe)with the result ofMqtt5SubscribeBuilder.Complete.build().- Returns:
- the fluent builder for the Subscribe message.
- Since:
- 1.2
- See Also:
-
publishes
@CheckReturnValue @NotNull @NotNull Flowable<Mqtt5Publish> publishes(@NotNull @NotNull MqttGlobalPublishFilter filter) Creates aFlowablefor globally consuming all incoming Publish messages matching the given filter.The returned
Flowablerepresents the source of the incoming Publish messages matching the given type. Calling this method does not start consuming yet. This is done lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returnedFlowable.- Parameters:
filter- the filter with which all incoming Publish messages are filtered.- Returns:
- the
Flowablewhich- emits the incoming Publish messages matching the given filter,
- never completes but
- errors with a
MqttSessionExpiredExceptionwhen the MQTT session expires.
- See Also:
-
publishes
@CheckReturnValue @NotNull @NotNull Flowable<Mqtt5Publish> publishes(@NotNull @NotNull MqttGlobalPublishFilter filter, boolean manualAcknowledgement) Creates aFlowablefor globally consuming all incoming Publish messages matching the given filter.The returned
Flowablerepresents the source of the incoming Publish messages matching the given type. Calling this method does not start consuming yet. This is done lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returnedFlowable.- Parameters:
filter- the filter with which all incoming Publish messages are filtered.manualAcknowledgement- whether the Publish messages are acknowledged manually.- Returns:
- the
Flowablewhich- emits the incoming Publish messages matching the given filter,
- never completes but
- errors with a
MqttSessionExpiredExceptionwhen the MQTT session expires.
- Since:
- 1.2
- See Also:
-
unsubscribe
@CheckReturnValue @NotNull @NotNull Single<Mqtt5UnsubAck> unsubscribe(@NotNull @NotNull Mqtt5Unsubscribe unsubscribe) Creates aSinglefor unsubscribing this client with the given Unsubscribe message.The returned
Singlerepresents the source of the UnsubAck message corresponding to the given Unsubscribe message. Calling this method does not unsubscribe yet. Unsubscribing is performed lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returnedSingle.- Parameters:
unsubscribe- the Unsubscribe message sent to the broker during unsubscribe.- Returns:
- the
Singlewhich- succeeds with the UnsubAck message if at least one Topic Filter of the Unsubscribe message was successfully unsubscribed (the UnsubAck message contains at least one Reason Code that is not an Error Code),
- errors with a
Mqtt5UnsubAckExceptionwrapping the UnsubAck message if it only contains Error Codes or - errors with a different exception if an error occurred before the Unsubscribe message was sent or before a UnsubAck message was received.
-
unsubscribeWith
@CheckReturnValue @NotNull Mqtt5UnsubscribeBuilder.Nested.Start<Single<Mqtt5UnsubAck>> unsubscribeWith()Fluent counterpart ofunsubscribe(Mqtt5Unsubscribe).Calling
Mqtt5UnsubscribeBuilder.Nested.Complete.applyUnsubscribe()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
@CheckReturnValue @NotNull @NotNull Flowable<Mqtt5PublishResult> publish(@NotNull @NotNull Flowable<Mqtt5Publish> publishFlowable) Creates aFlowablefor publishing the Publish messages emitted by the givenFlowable.The returned
Flowablerepresents the source ofMqtt5PublishResults each corresponding to a Publish message emitted by the givenFlowable. Calling this method does not start publishing yet. Publishing is performed lazy and asynchronous. When subscribing (in terms of Reactive Streams) to the returnedFlowablethe client subscribes (in terms of Reactive Streams) to the givenFlowable.- Parameters:
publishFlowable- the source of the Publish messages to publish.- Returns:
- the
Flowablewhich- emits
Mqtt5PublishResults each corresponding to a Publish message, - completes if the given
Flowablecompletes, but not before allMqtt5PublishResults were emitted, or - errors with the same exception if the given
Flowableerrors, but not before allMqtt5PublishResults were emitted.
- emits
-
reauth
Creates aCompletablefor re-authenticating this client.Calling this method does not re-authenticate yet. Re-authenticating is performed lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returned
Completable.- Returns:
- the
Completablewhich- completes when the client was successfully re-authenticated,
- errors with a
Mqtt5AuthExceptionwrapping the Auth message with the Error Code if not re-authenticated successfully or - errors with a different exception if an error occurred before the first Auth message was sent or before the last Auth message was received.
-
disconnect
Creates aCompletablefor disconnecting this client with the default Disconnect message.- Returns:
- see
disconnect(Mqtt5Disconnect). - See Also:
-
disconnect
@CheckReturnValue @NotNull @NotNull Completable disconnect(@NotNull @NotNull Mqtt5Disconnect disconnect) Creates aCompletablefor disconnecting this client with the given Disconnect message.Calling this method does not disconnect yet. Disconnecting is performed lazy and asynchronous when subscribing (in terms of Reactive Streams) to the returned
Completable.- Parameters:
disconnect- the Disconnect message sent to the broker during disconnect.- Returns:
- the
Completablewhich- completes when the client was successfully disconnected or
- errors if not disconnected gracefully.
-
disconnectWith
Fluent counterpart ofdisconnect(Mqtt5Disconnect).Calling
Mqtt5DisconnectBuilder.Nested.applyDisconnect()on the returned builder has the same effect as callingdisconnect(Mqtt5Disconnect)with the result ofMqtt5DisconnectBuilder.build().- Returns:
- the builder for the Disconnect message.
- See Also:
-
toRx
Description copied from interface:Mqtt5ClientTurns the API of this client into a reactive API.The reactive API can be used simultaneously with the other APIs.
- Specified by:
toRxin interfaceMqtt5Client- Returns:
- a reactive API for this client.
-
subscribePublishes(Mqtt5Subscribe).