public class MqttAsyncClient extends java.lang.Object implements Mqtt5AsyncClient
Modifier and Type | Class and Description |
---|---|
static class |
MqttAsyncClient.MqttSubscribeAndCallbackBuilder |
Mqtt5AsyncClient.Mqtt5SubscribeAndCallbackBuilder
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 java.util.concurrent.CompletableFuture<Mqtt5ConnAck> |
connect(@Nullable Mqtt5Connect connect)
Connects this client with the given Connect message.
|
@NotNull java.util.concurrent.CompletableFuture<java.lang.Void> |
disconnect(@Nullable Mqtt5Disconnect disconnect)
Disconnects this client with the given Disconnect message.
|
@NotNull MqttClientConfig |
getConfig() |
@NotNull java.util.concurrent.CompletableFuture<Mqtt5PublishResult> |
publish(@Nullable Mqtt5Publish publish)
Publishes the given Publish message.
|
void |
publishes(@Nullable MqttGlobalPublishFilter filter,
@Nullable java.util.function.Consumer<Mqtt5Publish> callback)
Globally consumes all incoming Publish messages matching the given filter.
|
void |
publishes(@Nullable MqttGlobalPublishFilter filter,
@Nullable java.util.function.Consumer<Mqtt5Publish> callback,
@Nullable java.util.concurrent.Executor executor)
Globally consumes all incoming Publish messages matching the given filter.
|
@NotNull java.util.concurrent.CompletableFuture<java.lang.Void> |
reauth()
Re-authenticates this client.
|
@NotNull java.util.concurrent.CompletableFuture<Mqtt5SubAck> |
subscribe(@Nullable Mqtt5Subscribe subscribe)
Subscribes this client with the given Subscribe message.
|
@NotNull java.util.concurrent.CompletableFuture<Mqtt5SubAck> |
subscribe(@Nullable Mqtt5Subscribe subscribe,
@Nullable java.util.function.Consumer<Mqtt5Publish> callback)
Subscribes this client with the given Subscribe message and consumes the the incoming Publish messages matching
the subscriptions of the Subscribe message with a callback.
|
@NotNull java.util.concurrent.CompletableFuture<Mqtt5SubAck> |
subscribe(@Nullable Mqtt5Subscribe subscribe,
@Nullable java.util.function.Consumer<Mqtt5Publish> callback,
@Nullable java.util.concurrent.Executor executor)
Subscribes this client with the given Subscribe message and consumes the the incoming Publish messages matching
the subscriptions of the Subscribe message with a callback.
|
@NotNull MqttBlockingClient |
toBlocking()
Turns the API of this client into a blocking API.
|
@NotNull MqttRxClient |
toRx()
Turns the API of this client into a reactive API.
|
@NotNull java.util.concurrent.CompletableFuture<Mqtt5UnsubAck> |
unsubscribe(@Nullable Mqtt5Unsubscribe unsubscribe)
Unsubscribes this client with the given Unsubscribe message.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect, connectWith, disconnect, disconnectWith, publishWith, subscribeWith, toAsync, unsubscribeWith
builder
@NotNull public @NotNull java.util.concurrent.CompletableFuture<Mqtt5ConnAck> connect(@Nullable @Nullable Mqtt5Connect connect)
Mqtt5AsyncClient
connect
in interface Mqtt5AsyncClient
connect
- the Connect message sent to the broker.CompletableFuture
which
Mqtt5ConnAckException
wrapping the ConnAck message if it contains an Error Code or@NotNull public @NotNull java.util.concurrent.CompletableFuture<Mqtt5SubAck> subscribe(@Nullable @Nullable Mqtt5Subscribe subscribe)
Mqtt5AsyncClient
See Mqtt5AsyncClient.publishes(MqttGlobalPublishFilter, Consumer)
or Mqtt5AsyncClient.publishes(MqttGlobalPublishFilter, Consumer,
Executor)
to consume the incoming Publish messages. Alternatively, call Mqtt5AsyncClient.subscribe(Mqtt5Subscribe,
Consumer)
or Mqtt5AsyncClient.subscribe(Mqtt5Subscribe, Consumer, Executor)
to consume the incoming Publish messages
matching the subscriptions of the Subscribe message directly.
subscribe
in interface Mqtt5AsyncClient
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 public @NotNull java.util.concurrent.CompletableFuture<Mqtt5SubAck> subscribe(@Nullable @Nullable Mqtt5Subscribe subscribe, @Nullable @Nullable java.util.function.Consumer<Mqtt5Publish> callback)
Mqtt5AsyncClient
subscribe
in interface Mqtt5AsyncClient
subscribe
- the Subscribe messages sent to the broker.callback
- the callback for consuming the incoming Publish messages matching the subscriptions of the
Subscribe message.Mqtt5AsyncClient.subscribe(Mqtt5Subscribe)
.Mqtt5AsyncClient.subscribe(Mqtt5Subscribe, Consumer, Executor)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<Mqtt5SubAck> subscribe(@Nullable @Nullable Mqtt5Subscribe subscribe, @Nullable @Nullable java.util.function.Consumer<Mqtt5Publish> callback, @Nullable @Nullable java.util.concurrent.Executor executor)
Mqtt5AsyncClient
The future is completed and the callback is executed on the given executor.
subscribe
in interface Mqtt5AsyncClient
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.Mqtt5AsyncClient.subscribe(Mqtt5Subscribe)
.Mqtt5AsyncClient.subscribe(Mqtt5Subscribe, Consumer)
public void publishes(@Nullable @Nullable MqttGlobalPublishFilter filter, @Nullable @Nullable java.util.function.Consumer<Mqtt5Publish> callback)
Mqtt5AsyncClient
publishes
in interface Mqtt5AsyncClient
filter
- the filter with which all incoming Publish messages are filtered.callback
- the callback for all incoming Publish messages matching the given filter.Mqtt5AsyncClient.publishes(MqttGlobalPublishFilter, Consumer, Executor)
public void publishes(@Nullable @Nullable MqttGlobalPublishFilter filter, @Nullable @Nullable java.util.function.Consumer<Mqtt5Publish> callback, @Nullable @Nullable java.util.concurrent.Executor executor)
Mqtt5AsyncClient
publishes
in interface Mqtt5AsyncClient
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.Mqtt5AsyncClient.publishes(MqttGlobalPublishFilter, Consumer)
@NotNull public @NotNull java.util.concurrent.CompletableFuture<Mqtt5UnsubAck> unsubscribe(@Nullable @Nullable Mqtt5Unsubscribe unsubscribe)
Mqtt5AsyncClient
unsubscribe
in interface Mqtt5AsyncClient
unsubscribe
- the Unsubscribe message sent to the broker.CompletableFuture
which
Mqtt5UnsubAckException
wrapping the UnsubAck message if it contains at least one Error Code or@NotNull public @NotNull java.util.concurrent.CompletableFuture<Mqtt5PublishResult> publish(@Nullable @Nullable Mqtt5Publish publish)
Mqtt5AsyncClient
publish
in interface Mqtt5AsyncClient
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@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.lang.Void> reauth()
Mqtt5AsyncClient
reauth
in interface Mqtt5AsyncClient
CompletableFuture
which
Mqtt5AuthException
wrapping the Auth message with the Error Code if not re-authenticated successfully
or@NotNull public @NotNull java.util.concurrent.CompletableFuture<java.lang.Void> disconnect(@Nullable @Nullable Mqtt5Disconnect disconnect)
Mqtt5AsyncClient
disconnect
in interface Mqtt5AsyncClient
disconnect
- the Disconnect message sent to the broker.CompletableFuture
which
@NotNull public @NotNull MqttClientConfig getConfig()
getConfig
in interface Mqtt5Client
getConfig
in interface MqttClient
@NotNull public @NotNull MqttRxClient toRx()
Mqtt5Client
The reactive API can be used simultaneously with the other APIs.
toRx
in interface Mqtt5Client
@NotNull public @NotNull MqttBlockingClient toBlocking()
Mqtt5Client
The blocking API can be used simultaneously with the other APIs.
toBlocking
in interface Mqtt5Client