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, waitcreate, isConnected, publishpublic 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()
MqttClientSessionSessionState.CONNECTED.start in interface MqttClientSessionpublic io.vertx.core.Future<Void> stop()
MqttClientSessionSessionState.DISCONNECTED.stop in interface MqttClientSessionpublic SessionState getState()
MqttClientSessiongetState in interface MqttClientSessionpublic SubscriptionState getSubscriptionState(String topicFilter)
MqttClientSessiongetSubscriptionState in interface MqttClientSessiontopicFilter - The topic filter to get the state for.public io.vertx.core.Future<Integer> subscribe(String topic, RequestedQoS qos)
MqttClientSessionsubscribe in interface MqttClientSessiontopic - The topic to subscribe to.qos - The QoS to request from the server.public io.vertx.core.Future<Void> unsubscribe(String topic)
MqttClientSessionunsubscribe in interface MqttClientSessiontopic - Topic you want to unsubscribe frompublic MqttClientSession exceptionHandler(io.vertx.core.Handler<Throwable> exceptionHandler)
MqttClientSessionexceptionHandler in interface MqttClientSessionexceptionHandler - handler to callpublic MqttClientSession sessionStateHandler(io.vertx.core.Handler<SessionEvent> sessionStateHandler)
MqttClientSessionsessionStateHandler in interface MqttClientSessionsessionStateHandler - The new handler, will overwrite the old one.public MqttClientSession subscriptionStateHandler(io.vertx.core.Handler<SubscriptionEvent> subscriptionStateHandler)
MqttClientSessionsubscriptionStateHandler in interface MqttClientSessionsubscriptionStateHandler - The new handler, will overwrite the old one.public MqttClientSession publishCompletionHandler(io.vertx.core.Handler<Integer> publishCompleteHandler)
MqttClientSessionpublishCompletionHandler in interface MqttClientSessionpublishCompleteHandler - The new handler, will overwrite the old one.MqttClient.publishCompletionHandler(Handler)public MqttClientSession publishCompletionExpirationHandler(io.vertx.core.Handler<Integer> publishCompletionExpirationHandler)
MqttClientSessionpublishCompletionExpirationHandler in interface MqttClientSessionpublishCompletionExpirationHandler - The new handler, will overwrite the old one.MqttClient.publishCompletionExpirationHandler(Handler)public MqttClientSession publishCompletionUnknownPacketIdHandler(io.vertx.core.Handler<Integer> publishCompletionUnknownPacketIdHandler)
MqttClientSessionpublishCompletionUnknownPacketIdHandler in interface MqttClientSessionpublishCompletionUnknownPacketIdHandler - The new handler, will overwrite the old one.MqttClient.publishCompletionUnknownPacketIdHandler(Handler)public MqttClientSession messageHandler(io.vertx.core.Handler<io.vertx.mqtt.messages.MqttPublishMessage> messageHandler)
MqttClientSessionmessageHandler in interface MqttClientSessionmessageHandler - 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)
MqttClientSessionpublish in interface MqttClientSessiontopic - 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.