public class MqttClientSessionImpl extends Object implements MqttClientSession
Constructor and Description |
---|
MqttClientSessionImpl(io.vertx.core.Vertx vertx,
MqttClientSessionOptions options)
Create a new instance, which is not started.
|
Modifier and Type | Method and Description |
---|---|
MqttClientSession |
exceptionHandler(io.vertx.core.Handler<Throwable> exceptionHandler)
Sets handler which will be called in case of an exception
|
SessionState |
getState()
Get the current session state.
|
SubscriptionState |
getSubscriptionState(String topicFilter)
Get a current subscription state.
|
MqttClientSession |
messageHandler(io.vertx.core.Handler<io.vertx.mqtt.messages.MqttPublishMessage> messageHandler)
Sets handler which will be called each time server publish something to client
|
io.vertx.core.Future<Integer> |
publish(String topic,
io.vertx.core.buffer.Buffer payload,
io.netty.handler.codec.mqtt.MqttQoS qosLevel,
boolean isDup,
boolean isRetain)
Sends the PUBLISH message to the remote MQTT server
|
MqttClientSession |
publishCompletionExpirationHandler(io.vertx.core.Handler<Integer> publishCompletionExpirationHandler)
Set the publish completion expiration handler.
|
MqttClientSession |
publishCompletionHandler(io.vertx.core.Handler<Integer> publishCompleteHandler)
Set the publish complete handler.
|
MqttClientSession |
publishCompletionUnknownPacketIdHandler(io.vertx.core.Handler<Integer> publishCompletionUnknownPacketIdHandler)
Set the publish completion unknown packet id handler.
|
MqttClientSession |
sessionStateHandler(io.vertx.core.Handler<SessionEvent> sessionStateHandler)
Set the session state handler.
|
io.vertx.core.Future<Void> |
start()
Start the session.
|
io.vertx.core.Future<Void> |
stop()
Stop the session.
|
io.vertx.core.Future<Integer> |
subscribe(String topic,
RequestedQoS qos)
Subscribes to a single topic with related QoS level.
|
MqttClientSession |
subscriptionStateHandler(io.vertx.core.Handler<SubscriptionEvent> subscriptionStateHandler)
Set the subscription state handler.
|
io.vertx.core.Future<Void> |
unsubscribe(String topic)
Unsubscribe from receiving messages on given topic
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, isConnected, publish
public MqttClientSessionImpl(io.vertx.core.Vertx vertx, MqttClientSessionOptions options)
vertx
- The vert.x instance to use.options
- The client session options.public io.vertx.core.Future<Void> start()
MqttClientSession
SessionState.CONNECTED
.start
in interface MqttClientSession
public io.vertx.core.Future<Void> stop()
MqttClientSession
SessionState.DISCONNECTED
.stop
in interface MqttClientSession
public SessionState getState()
MqttClientSession
getState
in interface MqttClientSession
public SubscriptionState getSubscriptionState(String topicFilter)
MqttClientSession
getSubscriptionState
in interface MqttClientSession
topicFilter
- The topic filter to get the state for.public io.vertx.core.Future<Integer> subscribe(String topic, RequestedQoS qos)
MqttClientSession
subscribe
in interface MqttClientSession
topic
- The topic to subscribe to.qos
- The QoS to request from the server.public io.vertx.core.Future<Void> unsubscribe(String topic)
MqttClientSession
unsubscribe
in interface MqttClientSession
topic
- Topic you want to unsubscribe frompublic MqttClientSession exceptionHandler(io.vertx.core.Handler<Throwable> exceptionHandler)
MqttClientSession
exceptionHandler
in interface MqttClientSession
exceptionHandler
- handler to callpublic MqttClientSession sessionStateHandler(io.vertx.core.Handler<SessionEvent> sessionStateHandler)
MqttClientSession
sessionStateHandler
in interface MqttClientSession
sessionStateHandler
- The new handler, will overwrite the old one.public MqttClientSession subscriptionStateHandler(io.vertx.core.Handler<SubscriptionEvent> subscriptionStateHandler)
MqttClientSession
subscriptionStateHandler
in interface MqttClientSession
subscriptionStateHandler
- The new handler, will overwrite the old one.public MqttClientSession publishCompletionHandler(io.vertx.core.Handler<Integer> publishCompleteHandler)
MqttClientSession
publishCompletionHandler
in interface MqttClientSession
publishCompleteHandler
- The new handler, will overwrite the old one.MqttClient.publishCompletionHandler(Handler)
public MqttClientSession publishCompletionExpirationHandler(io.vertx.core.Handler<Integer> publishCompletionExpirationHandler)
MqttClientSession
publishCompletionExpirationHandler
in interface MqttClientSession
publishCompletionExpirationHandler
- The new handler, will overwrite the old one.MqttClient.publishCompletionExpirationHandler(Handler)
public MqttClientSession publishCompletionUnknownPacketIdHandler(io.vertx.core.Handler<Integer> publishCompletionUnknownPacketIdHandler)
MqttClientSession
publishCompletionUnknownPacketIdHandler
in interface MqttClientSession
publishCompletionUnknownPacketIdHandler
- The new handler, will overwrite the old one.MqttClient.publishCompletionUnknownPacketIdHandler(Handler)
public MqttClientSession messageHandler(io.vertx.core.Handler<io.vertx.mqtt.messages.MqttPublishMessage> messageHandler)
MqttClientSession
messageHandler
in interface MqttClientSession
messageHandler
- handler to callpublic io.vertx.core.Future<Integer> publish(String topic, io.vertx.core.buffer.Buffer payload, io.netty.handler.codec.mqtt.MqttQoS qosLevel, boolean isDup, boolean isRetain)
MqttClientSession
publish
in interface MqttClientSession
topic
- topic on which the message is publishedpayload
- message payloadqosLevel
- QoS levelisDup
- if the message is a duplicateisRetain
- if the message needs to be retainedFuture
completed after PUBLISH packet sent with packetid (not when QoS 0)Copyright © 2018–2021 SmallRye. All rights reserved.