@DoNotImplement public interface Mqtt5AsyncClient extends Mqtt5Client
Mqtt5Client
based on futures and callbacks.Modifier and Type | Interface and Description |
---|---|
static interface |
Mqtt5AsyncClient.Mqtt5SubscribeAndCallbackBuilder
Builder for a
Mqtt5Subscribe and additional arguments that are applied to a subscribe(Mqtt5Subscribe) , subscribe(Mqtt5Subscribe, Consumer, boolean) or subscribe(Mqtt5Subscribe, Consumer, Executor, boolean) call. |
DEFAULT_SERVER_HOST, DEFAULT_SERVER_PORT, DEFAULT_SERVER_PORT_SSL, DEFAULT_SERVER_PORT_WEBSOCKET, DEFAULT_SERVER_PORT_WEBSOCKET_SSL
Modifier and Type | Method and Description |
---|---|
@NotNull CompletableFuture<Mqtt5ConnAck> |
connect()
Connects this client with the default Connect message.
|
@NotNull CompletableFuture<Mqtt5ConnAck> |
connect(@NotNull Mqtt5Connect connect)
Connects this client with the given Connect message.
|
Mqtt5ConnectBuilder.Send<CompletableFuture<Mqtt5ConnAck>> |
connectWith()
Fluent counterpart of
connect(Mqtt5Connect) . |
@NotNull CompletableFuture<Void> |
disconnect()
Disconnects this client with the default Disconnect message.
|
@NotNull CompletableFuture<Void> |
disconnect(@NotNull Mqtt5Disconnect disconnect)
Disconnects this client with the given Disconnect message.
|
Mqtt5DisconnectBuilder.Send<CompletableFuture<Void>> |
disconnectWith()
Fluent counterpart of
disconnect(Mqtt5Disconnect) . |
@NotNull CompletableFuture<Mqtt5PublishResult> |
publish(@NotNull Mqtt5Publish publish)
Publishes the given Publish message.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt5Publish> callback)
Globally consumes all incoming Publish messages matching the given filter.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt5Publish> callback,
boolean manualAcknowledgement)
Globally consumes all incoming Publish messages matching the given filter.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt5Publish> callback,
@NotNull Executor executor)
Globally consumes all incoming Publish messages matching the given filter.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt5Publish> callback,
@NotNull Executor executor,
boolean manualAcknowledgement)
Globally consumes all incoming Publish messages matching the given filter.
|
Mqtt5PublishBuilder.Send<CompletableFuture<Mqtt5PublishResult>> |
publishWith()
Fluent counterpart of
publish(Mqtt5Publish) . |
@NotNull CompletableFuture<Void> |
reauth()
Re-authenticates this client.
|
@NotNull CompletableFuture<Mqtt5SubAck> |
subscribe(@NotNull Mqtt5Subscribe subscribe)
Subscribes this client with the given Subscribe message.
|
@NotNull CompletableFuture<Mqtt5SubAck> |
subscribe(@NotNull Mqtt5Subscribe subscribe,
@NotNull Consumer<Mqtt5Publish> callback)
Subscribes this client with the given Subscribe message and consumes the incoming Publish messages matching the
subscriptions of the Subscribe message with a callback.
|
@NotNull CompletableFuture<Mqtt5SubAck> |
subscribe(@NotNull Mqtt5Subscribe subscribe,
@NotNull Consumer<Mqtt5Publish> callback,
boolean manualAcknowledgement)
Subscribes this client with the given Subscribe message and consumes the incoming Publish messages matching the
subscriptions of the Subscribe message with a callback.
|
@NotNull CompletableFuture<Mqtt5SubAck> |
subscribe(@NotNull Mqtt5Subscribe subscribe,
@NotNull Consumer<Mqtt5Publish> callback,
@NotNull Executor executor)
Subscribes this client with the given Subscribe message and consumes the incoming Publish messages matching the
subscriptions of the Subscribe message with a callback.
|
@NotNull CompletableFuture<Mqtt5SubAck> |
subscribe(@NotNull Mqtt5Subscribe subscribe,
@NotNull Consumer<Mqtt5Publish> callback,
@NotNull Executor executor,
boolean manualAcknowledgement)
Subscribes this client with the given Subscribe message and consumes the incoming Publish messages matching the
subscriptions of the Subscribe message with a callback.
|
Mqtt5AsyncClient.Mqtt5SubscribeAndCallbackBuilder.Start |
subscribeWith()
|
default @NotNull Mqtt5AsyncClient |
toAsync()
Turns the API of this client into a asynchronous API based on futures and callbacks.
|
@NotNull CompletableFuture<Mqtt5UnsubAck> |
unsubscribe(@NotNull Mqtt5Unsubscribe unsubscribe)
Unsubscribes this client with the given Unsubscribe message.
|
Mqtt5UnsubscribeBuilder.Send.Start<CompletableFuture<Mqtt5UnsubAck>> |
unsubscribeWith()
Fluent counterpart of
unsubscribe(Mqtt5Unsubscribe) . |
builder, getConfig, toBlocking, toRx
getState
@NotNull @NotNull CompletableFuture<Mqtt5ConnAck> connect()
connect(Mqtt5Connect)
.connect(Mqtt5Connect)
@NotNull @NotNull CompletableFuture<Mqtt5ConnAck> connect(@NotNull @NotNull Mqtt5Connect connect)
connect
- the Connect message sent to the broker.CompletableFuture
which
Mqtt5ConnAckException
wrapping the ConnAck message if it contains an Error Code or
@CheckReturnValue Mqtt5ConnectBuilder.Send<CompletableFuture<Mqtt5ConnAck>> connectWith()
connect(Mqtt5Connect)
.
Calling Mqtt5ConnectBuilder.Send#send()
on the returned builder has the same effect as calling connect(Mqtt5Connect)
with the result of Mqtt5ConnectBuilder.build()
.
connect(Mqtt5Connect)
@NotNull @NotNull CompletableFuture<Mqtt5SubAck> subscribe(@NotNull @NotNull Mqtt5Subscribe subscribe)
See publishes(MqttGlobalPublishFilter, Consumer)
or publishes(MqttGlobalPublishFilter, Consumer,
Executor)
to consume the incoming Publish messages. Alternatively, call subscribe(Mqtt5Subscribe,
Consumer)
or subscribe(Mqtt5Subscribe, Consumer, Executor)
to consume the incoming Publish messages
matching the subscriptions of the Subscribe message directly.
subscribe
- the Subscribe messages sent to the broker.CompletableFuture
which
Mqtt5SubAckException
wrapping the SubAck message if it contains at least one Error Code or
@NotNull @NotNull CompletableFuture<Mqtt5SubAck> subscribe(@NotNull @NotNull Mqtt5Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt5Publish> callback)
subscribe
- the Subscribe messages sent to the broker.callback
- the callback for consuming the incoming Publish messages matching the subscriptions of the
Subscribe message.subscribe(Mqtt5Subscribe)
.subscribe(Mqtt5Subscribe, Consumer, Executor)
,
subscribe(Mqtt5Subscribe, Consumer, boolean)
,
subscribe(Mqtt5Subscribe, Consumer, Executor, boolean)
@NotNull @NotNull CompletableFuture<Mqtt5SubAck> subscribe(@NotNull @NotNull Mqtt5Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt5Publish> callback, @NotNull @NotNull Executor executor)
The future is completed and the callback is executed on the given executor.
subscribe
- the Subscribe messages sent to the broker.callback
- the callback for consuming the incoming Publish messages matching the subscriptions of the
Subscribe message.executor
- the executor where the future is completed and the callback is executed on.subscribe(Mqtt5Subscribe)
.subscribe(Mqtt5Subscribe, Consumer)
,
subscribe(Mqtt5Subscribe, Consumer, boolean)
,
subscribe(Mqtt5Subscribe, Consumer, Executor, boolean)
@NotNull @NotNull CompletableFuture<Mqtt5SubAck> subscribe(@NotNull @NotNull Mqtt5Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt5Publish> callback, boolean manualAcknowledgement)
subscribe
- the Subscribe messages sent to the broker.callback
- the callback for consuming the incoming Publish messages matching the subscriptions
of the Subscribe message.manualAcknowledgement
- whether the Publish messages are acknowledged manually.subscribe(Mqtt5Subscribe)
.subscribe(Mqtt5Subscribe, Consumer)
,
subscribe(Mqtt5Subscribe, Consumer, Executor)
,
subscribe(Mqtt5Subscribe, Consumer, Executor, boolean)
@NotNull @NotNull CompletableFuture<Mqtt5SubAck> subscribe(@NotNull @NotNull Mqtt5Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt5Publish> callback, @NotNull @NotNull Executor executor, boolean manualAcknowledgement)
The future is completed and the callback is executed on the given executor.
subscribe
- the Subscribe messages sent to the broker.callback
- the callback for consuming the incoming Publish messages matching the subscriptions
of the Subscribe message.executor
- the executor where the future is completed and the callback is executed on.manualAcknowledgement
- whether the Publish messages are acknowledged manually.subscribe(Mqtt5Subscribe)
.subscribe(Mqtt5Subscribe, Consumer)
,
subscribe(Mqtt5Subscribe, Consumer, Executor)
,
subscribe(Mqtt5Subscribe, Consumer, boolean)
@CheckReturnValue Mqtt5AsyncClient.Mqtt5SubscribeAndCallbackBuilder.Start subscribeWith()
subscribe(Mqtt5Subscribe)
, subscribe(Mqtt5Subscribe, Consumer, boolean)
and subscribe(Mqtt5Subscribe, Consumer, Executor, boolean)
.
Calling Mqtt5AsyncClient.Mqtt5SubscribeAndCallbackBuilder.Call.send()
on the returned builder has the same effect as
calling one of the following methods:
subscribe(Mqtt5Subscribe)
if no callback has been supplied to the builder
subscribe(Mqtt5Subscribe, Consumer)
if only a callback has been supplied to the builder
subscribe(Mqtt5Subscribe, Consumer, Executor)
if a callback and an executor has been supplied to
the builder
subscribe(Mqtt5Subscribe)
,
subscribe(Mqtt5Subscribe, Consumer, boolean)
,
subscribe(Mqtt5Subscribe, Consumer, Executor, boolean)
void publishes(@NotNull @NotNull MqttGlobalPublishFilter filter, @NotNull @NotNull Consumer<Mqtt5Publish> callback)
filter
- the filter with which all incoming Publish messages are filtered.callback
- the callback for all incoming Publish messages matching the given filter.publishes(MqttGlobalPublishFilter, Consumer, Executor)
,
publishes(MqttGlobalPublishFilter, Consumer, boolean)
,
publishes(MqttGlobalPublishFilter, Consumer, Executor, boolean)
void publishes(@NotNull @NotNull MqttGlobalPublishFilter filter, @NotNull @NotNull Consumer<Mqtt5Publish> callback, @NotNull @NotNull Executor executor)
filter
- the filter with which all incoming Publish messages are filtered.callback
- the callback for all incoming Publish messages matching the given filter.executor
- the executor where the callback is executed on.publishes(MqttGlobalPublishFilter, Consumer)
,
publishes(MqttGlobalPublishFilter, Consumer, boolean)
,
publishes(MqttGlobalPublishFilter, Consumer, Executor, boolean)
void publishes(@NotNull @NotNull MqttGlobalPublishFilter filter, @NotNull @NotNull Consumer<Mqtt5Publish> callback, boolean manualAcknowledgement)
filter
- the filter with which all incoming Publish messages are filtered.callback
- the callback for all incoming Publish messages matching the given filter.manualAcknowledgement
- whether the Publish messages are acknowledged manually.publishes(MqttGlobalPublishFilter, Consumer)
,
publishes(MqttGlobalPublishFilter, Consumer, Executor)
,
publishes(MqttGlobalPublishFilter, Consumer, Executor, boolean)
void publishes(@NotNull @NotNull MqttGlobalPublishFilter filter, @NotNull @NotNull Consumer<Mqtt5Publish> callback, @NotNull @NotNull Executor executor, boolean manualAcknowledgement)
filter
- the filter with which all incoming Publish messages are filtered.callback
- the callback for all incoming Publish messages matching the given filter.executor
- the executor where the callback is executed on.manualAcknowledgement
- whether the Publish messages are acknowledged manually.publishes(MqttGlobalPublishFilter, Consumer)
,
publishes(MqttGlobalPublishFilter, Consumer, Executor)
,
publishes(MqttGlobalPublishFilter, Consumer, boolean)
@NotNull @NotNull CompletableFuture<Mqtt5UnsubAck> unsubscribe(@NotNull @NotNull Mqtt5Unsubscribe unsubscribe)
unsubscribe
- the Unsubscribe message sent to the broker.CompletableFuture
which
Mqtt5UnsubAckException
wrapping the UnsubAck message if it contains at least one Error Code or
@CheckReturnValue Mqtt5UnsubscribeBuilder.Send.Start<CompletableFuture<Mqtt5UnsubAck>> unsubscribeWith()
unsubscribe(Mqtt5Unsubscribe)
.
Calling Mqtt5UnsubscribeBuilder.Send.Complete#send()
on the returned builder has the same effect as
calling unsubscribe(Mqtt5Unsubscribe)
with the result of Mqtt5UnsubscribeBuilder.Complete#build()
.
unsubscribe(Mqtt5Unsubscribe)
@NotNull @NotNull CompletableFuture<Mqtt5PublishResult> publish(@NotNull @NotNull Mqtt5Publish publish)
publish
- the Publish message sent to the broker.CompletableFuture
which
Mqtt5PublishResult
if the Publish message was successfully
published (no acknowledgement message contains an Error Code, Mqtt5PublishResult.getError()
will always be absent),
Mqtt5PubAckException
or Mqtt5PubRecException
wrapping the acknowledgement message if it contains an Error Code or
@CheckReturnValue Mqtt5PublishBuilder.Send<CompletableFuture<Mqtt5PublishResult>> publishWith()
publish(Mqtt5Publish)
.
Calling Mqtt5PublishBuilder.Send.Complete#send()
on the returned builder has the same effect as calling
publish(Mqtt5Publish)
with the result of Mqtt5PublishBuilder.Complete#build()
.
publish(Mqtt5Publish)
@NotNull @NotNull CompletableFuture<Void> reauth()
CompletableFuture
which
Mqtt5AuthException
wrapping the Auth message with the Error Code if not re-authenticated successfully or
@NotNull @NotNull CompletableFuture<Void> disconnect()
disconnect(Mqtt5Disconnect)
.disconnect(Mqtt5Disconnect)
@NotNull @NotNull CompletableFuture<Void> disconnect(@NotNull @NotNull Mqtt5Disconnect disconnect)
disconnect
- the Disconnect message sent to the broker.CompletableFuture
which
@CheckReturnValue Mqtt5DisconnectBuilder.Send<CompletableFuture<Void>> disconnectWith()
disconnect(Mqtt5Disconnect)
.
Calling Mqtt5DisconnectBuilder.Send#send()
on the returned builder has the same effect as calling disconnect(Mqtt5Disconnect)
with the result of Mqtt5DisconnectBuilder.build()
.
disconnect(Mqtt5Disconnect)
@CheckReturnValue @NotNull default @NotNull Mqtt5AsyncClient toAsync()
Mqtt5Client
The asynchronous API can be used simultaneously with the other APIs.
toAsync
in interface Mqtt5Client