Interface Mqtt3RxClient
- All Superinterfaces:
Mqtt3Client,MqttClient
Mqtt3Client.- 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 Mqtt3Connect connect) Creates aSinglefor connecting this client with the given Connect message.Fluent counterpart ofconnect(Mqtt3Connect).Creates aCompletablefor disconnecting this client.publish(@NotNull Flowable<Mqtt3Publish> 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.subscribe(@NotNull Mqtt3Subscribe subscribe) Creates aSinglefor subscribing this client with the given Subscribe message.subscribePublishes(@NotNull Mqtt3Subscribe subscribe) Creates aFlowableWithSinglefor subscribing this client with the given Subscribe message.subscribePublishes(@NotNull Mqtt3Subscribe subscribe, boolean manualAcknowledgement) Creates aFlowableWithSinglefor subscribing this client with the given Subscribe message.Fluent counterpart ofsubscribePublishes(Mqtt3Subscribe, boolean).subscribeStream(@NotNull Mqtt3Subscribe subscribe) Deprecated.Deprecated.Fluent counterpart ofsubscribe(Mqtt3Subscribe).default @NotNull Mqtt3RxClienttoRx()Turns the API of this client into a reactive API.unsubscribe(@NotNull Mqtt3Unsubscribe unsubscribe) Creates aCompletablefor unsubscribing this client with the given Unsubscribe message.Fluent counterpart ofunsubscribe(Mqtt3Unsubscribe).Methods inherited from interface com.hivemq.client.mqtt.mqtt3.Mqtt3Client
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(Mqtt3Connect). - See Also:
-
connect
@CheckReturnValue @NotNull @NotNull Single<Mqtt3ConnAck> connect(@NotNull @NotNull Mqtt3Connect 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
Mqtt3ConnAckExceptionwrapping 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(Mqtt3Connect).Calling
Mqtt3ConnectBuilder.Nested.applyConnect()on the returned builder has the same effect as callingconnect(Mqtt3Connect)with the result ofMqtt3ConnectBuilder.build().- Returns:
- the fluent builder for the Connect message.
- See Also:
-
subscribe
@CheckReturnValue @NotNull @NotNull Single<Mqtt3SubAck> subscribe(@NotNull @NotNull Mqtt3Subscribe 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(Mqtt3Subscribe)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 Return Code that is not an Error Code),
- errors with a
Mqtt3SubAckExceptionwrapping 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(Mqtt3Subscribe).Calling
Mqtt3SubscribeBuilder.Nested.Complete.applySubscribe()on the returned builder has the same effect as callingsubscribe(Mqtt3Subscribe)with the result ofMqtt3SubscribeBuilder.Complete.build().- Returns:
- the fluent builder for the Subscribe message.
- See Also:
-
subscribeStream
@Deprecated @NotNull @NotNull FlowableWithSingle<Mqtt3Publish,Mqtt3SubAck> subscribeStream(@NotNull @NotNull Mqtt3Subscribe subscribe) Deprecated.- Parameters:
subscribe- usesubscribePublishes(Mqtt3Subscribe).- Returns:
- use
subscribePublishes(Mqtt3Subscribe).
-
subscribeStreamWith
@Deprecated @NotNull Mqtt3SubscribeBuilder.Nested.Start<FlowableWithSingle<Mqtt3Publish,Mqtt3SubAck>> subscribeStreamWith()Deprecated.- Returns:
- use
subscribePublishesWith().
-
subscribePublishes
@CheckReturnValue @NotNull @NotNull FlowableWithSingle<Mqtt3Publish,Mqtt3SubAck> subscribePublishes(@NotNull @NotNull Mqtt3Subscribe 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 Return 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
Mqtt3SubAckExceptionwrapping 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<Mqtt3Publish,Mqtt3SubAck> subscribePublishes(@NotNull @NotNull Mqtt3Subscribe 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 Return 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
Mqtt3SubAckExceptionwrapping 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 Mqtt3SubscribeBuilder.Publishes.Start<FlowableWithSingle<Mqtt3Publish,Mqtt3SubAck>> subscribePublishesWith()Fluent counterpart ofsubscribePublishes(Mqtt3Subscribe, boolean).Calling
Mqtt3SubscribeBuilder.Nested.Complete.applySubscribe()on the returned builder has the same effect as callingsubscribePublishes(Mqtt3Subscribe)with the result ofMqtt3SubscribeBuilder.Complete.build().- Returns:
- the fluent builder for the Subscribe message.
- Since:
- 1.2
- See Also:
-
publishes
@CheckReturnValue @NotNull @NotNull Flowable<Mqtt3Publish> 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<Mqtt3Publish> 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 Completable unsubscribe(@NotNull @NotNull Mqtt3Unsubscribe unsubscribe) Creates aCompletablefor unsubscribing this client with the given Unsubscribe message.The returned
Completablerepresents 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 returnedCompletable.- Parameters:
unsubscribe- the Unsubscribe message sent to the broker during unsubscribe.- Returns:
- the
Completablewhich- succeeds when the corresponding UnsubAck message was received or
- errors if an error occurred before the Unsubscribe message was sent or before a UnsubAck message was received.
-
unsubscribeWith
Fluent counterpart ofunsubscribe(Mqtt3Unsubscribe).Calling
Mqtt3UnsubscribeBuilder.Nested.Complete.applyUnsubscribe()on the returned builder has the same effect as callingunsubscribe(Mqtt3Unsubscribe)with the result ofMqtt3UnsubscribeBuilder.Complete.build().- Returns:
- the fluent builder for the Unsubscribe message.
- See Also:
-
publish
@CheckReturnValue @NotNull @NotNull Flowable<Mqtt3PublishResult> publish(@NotNull @NotNull Flowable<Mqtt3Publish> publishFlowable) Creates aFlowablefor publishing the Publish messages emitted by the givenFlowable.The returned
Flowablerepresents the source ofMqtt3PublishResults 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
Mqtt3PublishResults each corresponding to a Publish message, - completes if the given
Flowablecompletes, but not before allMqtt3PublishResults were emitted, or - errors with the same exception if the given
Flowableerrors, but not before allMqtt3PublishResults were emitted.
- emits
-
disconnect
Creates aCompletablefor disconnecting this client.Calling this method does not disconnect yet. Disconnecting 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 disconnected or
- errors if not disconnected gracefully.
-
toRx
Description copied from interface:Mqtt3ClientTurns the API of this client into a reactive API.The reactive API can be used simultaneously with the other APIs.
- Specified by:
toRxin interfaceMqtt3Client- Returns:
- a reactive API for this client.
-
subscribePublishes(Mqtt3Subscribe).