@DoNotImplement public interface Mqtt3AsyncClient extends Mqtt3Client
Mqtt3Client
based on futures and callbacks.Modifier and Type | Interface and Description |
---|---|
static interface |
Mqtt3AsyncClient.Mqtt3SubscribeAndCallbackBuilder
Builder for a
Mqtt3Subscribe and additional arguments that are applied to a subscribe(Mqtt3Subscribe) , subscribe(Mqtt3Subscribe, Consumer, boolean) or subscribe(Mqtt3Subscribe, 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<Mqtt3ConnAck> |
connect()
Connects this client with the default Connect message.
|
@NotNull CompletableFuture<Mqtt3ConnAck> |
connect(@NotNull Mqtt3Connect connect)
Connects this client with the given Connect message.
|
Mqtt3ConnectBuilder.Send<CompletableFuture<Mqtt3ConnAck>> |
connectWith()
Fluent counterpart of
connect(Mqtt3Connect) . |
@NotNull CompletableFuture<Void> |
disconnect()
Disconnects this client.
|
@NotNull CompletableFuture<Mqtt3Publish> |
publish(@NotNull Mqtt3Publish publish)
Publishes the given Publish message.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt3Publish> callback)
Globally consumes all incoming Publish messages matching the given filter.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt3Publish> callback,
boolean manualAcknowledgement)
Globally consumes all incoming Publish messages matching the given filter.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt3Publish> callback,
@NotNull Executor executor)
Globally consumes all incoming Publish messages matching the given filter.
|
void |
publishes(@NotNull MqttGlobalPublishFilter filter,
@NotNull Consumer<Mqtt3Publish> callback,
@NotNull Executor executor,
boolean manualAcknowledgement)
Globally consumes all incoming Publish messages matching the given filter.
|
Mqtt3PublishBuilder.Send<CompletableFuture<Mqtt3Publish>> |
publishWith()
Fluent counterpart of
publish(Mqtt3Publish) . |
@NotNull CompletableFuture<Mqtt3SubAck> |
subscribe(@NotNull Mqtt3Subscribe subscribe)
Subscribes this client with the given Subscribe message.
|
@NotNull CompletableFuture<Mqtt3SubAck> |
subscribe(@NotNull Mqtt3Subscribe subscribe,
@NotNull Consumer<Mqtt3Publish> 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<Mqtt3SubAck> |
subscribe(@NotNull Mqtt3Subscribe subscribe,
@NotNull Consumer<Mqtt3Publish> 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<Mqtt3SubAck> |
subscribe(@NotNull Mqtt3Subscribe subscribe,
@NotNull Consumer<Mqtt3Publish> 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<Mqtt3SubAck> |
subscribe(@NotNull Mqtt3Subscribe subscribe,
@NotNull Consumer<Mqtt3Publish> 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.
|
Mqtt3AsyncClient.Mqtt3SubscribeAndCallbackBuilder.Start |
subscribeWith()
|
default @NotNull Mqtt3AsyncClient |
toAsync()
Turns the API of this client into a asynchronous API based on futures and callbacks.
|
@NotNull CompletableFuture<Void> |
unsubscribe(@NotNull Mqtt3Unsubscribe unsubscribe)
Unsubscribes this client with the given Unsubscribe message.
|
Mqtt3UnsubscribeBuilder.Send.Start<CompletableFuture<Void>> |
unsubscribeWith()
Fluent counterpart of
unsubscribe(Mqtt3Unsubscribe) . |
builder, getConfig, toBlocking, toRx
getState
@NotNull @NotNull CompletableFuture<Mqtt3ConnAck> connect()
connect(Mqtt3Connect)
.connect(Mqtt3Connect)
@NotNull @NotNull CompletableFuture<Mqtt3ConnAck> connect(@NotNull @NotNull Mqtt3Connect connect)
connect
- the Connect message sent to the broker.CompletableFuture
which
Mqtt3ConnAckException
wrapping the ConnAck message if it contains an Error Code or
@CheckReturnValue Mqtt3ConnectBuilder.Send<CompletableFuture<Mqtt3ConnAck>> connectWith()
connect(Mqtt3Connect)
.
Calling Mqtt3ConnectBuilder.Send#send()
on the returned builder has the same effect as calling connect(Mqtt3Connect)
with the result of Mqtt3ConnectBuilder.build()
.
connect(Mqtt3Connect)
@NotNull @NotNull CompletableFuture<Mqtt3SubAck> subscribe(@NotNull @NotNull Mqtt3Subscribe subscribe)
See publishes(MqttGlobalPublishFilter, Consumer)
or publishes(MqttGlobalPublishFilter, Consumer,
Executor)
to consume the incoming Publish messages. Alternatively, call subscribe(Mqtt3Subscribe,
Consumer)
or subscribe(Mqtt3Subscribe, 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
Mqtt3SubAckException
wrapping the SubAck message if it contains at least one Error Code or
@NotNull @NotNull CompletableFuture<Mqtt3SubAck> subscribe(@NotNull @NotNull Mqtt3Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt3Publish> 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(Mqtt3Subscribe)
.subscribe(Mqtt3Subscribe, Consumer, Executor)
,
subscribe(Mqtt3Subscribe, Consumer, boolean)
,
subscribe(Mqtt3Subscribe, Consumer, Executor, boolean)
@NotNull @NotNull CompletableFuture<Mqtt3SubAck> subscribe(@NotNull @NotNull Mqtt3Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt3Publish> 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(Mqtt3Subscribe)
.subscribe(Mqtt3Subscribe, Consumer)
,
subscribe(Mqtt3Subscribe, Consumer, boolean)
,
subscribe(Mqtt3Subscribe, Consumer, Executor, boolean)
@NotNull @NotNull CompletableFuture<Mqtt3SubAck> subscribe(@NotNull @NotNull Mqtt3Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt3Publish> 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(Mqtt3Subscribe)
.subscribe(Mqtt3Subscribe, Consumer)
,
subscribe(Mqtt3Subscribe, Consumer, Executor)
,
subscribe(Mqtt3Subscribe, Consumer, Executor, boolean)
@NotNull @NotNull CompletableFuture<Mqtt3SubAck> subscribe(@NotNull @NotNull Mqtt3Subscribe subscribe, @NotNull @NotNull Consumer<Mqtt3Publish> 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(Mqtt3Subscribe)
.subscribe(Mqtt3Subscribe, Consumer)
,
subscribe(Mqtt3Subscribe, Consumer, Executor)
,
subscribe(Mqtt3Subscribe, Consumer, boolean)
@CheckReturnValue Mqtt3AsyncClient.Mqtt3SubscribeAndCallbackBuilder.Start subscribeWith()
subscribe(Mqtt3Subscribe)
, subscribe(Mqtt3Subscribe, Consumer, boolean)
and subscribe(Mqtt3Subscribe, Consumer, Executor, boolean)
.
Calling Mqtt3AsyncClient.Mqtt3SubscribeAndCallbackBuilder.Call.send()
on the returned builder has the same effect as
calling one of the following methods:
subscribe(Mqtt3Subscribe)
if no callback has been supplied to the builder
subscribe(Mqtt3Subscribe, Consumer)
if only a callback has been supplied to the builder
subscribe(Mqtt3Subscribe, Consumer, Executor)
if a callback and an executor have been supplied to
the builder
subscribe(Mqtt3Subscribe)
,
subscribe(Mqtt3Subscribe, Consumer, boolean)
,
subscribe(Mqtt3Subscribe, Consumer, Executor, boolean)
void publishes(@NotNull @NotNull MqttGlobalPublishFilter filter, @NotNull @NotNull Consumer<Mqtt3Publish> 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<Mqtt3Publish> 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<Mqtt3Publish> 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<Mqtt3Publish> 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<Void> unsubscribe(@NotNull @NotNull Mqtt3Unsubscribe unsubscribe)
unsubscribe
- the Unsubscribe message sent to the broker.CompletableFuture
which
@CheckReturnValue Mqtt3UnsubscribeBuilder.Send.Start<CompletableFuture<Void>> unsubscribeWith()
unsubscribe(Mqtt3Unsubscribe)
.
Calling Mqtt3UnsubscribeBuilder.Send.Complete#send()
on the returned builder has the same effect as
calling unsubscribe(Mqtt3Unsubscribe)
with the result of Mqtt3UnsubscribeBuilder.Complete#build()
.
unsubscribe(Mqtt3Unsubscribe)
@NotNull @NotNull CompletableFuture<Mqtt3Publish> publish(@NotNull @NotNull Mqtt3Publish publish)
publish
- the Publish message sent to the broker.CompletableFuture
which
@CheckReturnValue Mqtt3PublishBuilder.Send<CompletableFuture<Mqtt3Publish>> publishWith()
publish(Mqtt3Publish)
.
Calling Mqtt3PublishBuilder.Send.Complete#send()
on the returned builder has the same effect as calling
publish(Mqtt3Publish)
with the result of Mqtt3PublishBuilder.Complete#build()
.
publish(Mqtt3Publish)
@NotNull @NotNull CompletableFuture<Void> disconnect()
CompletableFuture
which
@CheckReturnValue @NotNull default @NotNull Mqtt3AsyncClient toAsync()
Mqtt3Client
The asynchronous API can be used simultaneously with the other APIs.
toAsync
in interface Mqtt3Client