Interface MqttSubscriptionHandle
-
- All Known Implementing Classes:
MqttSubscribeResult
public interface MqttSubscriptionHandleHandle for a high-level client subscription.The handle represents the subscription request accepted through the high-level client API. It is intentionally small: the current client still exposes received MQTT messages through the existing blocking
PlccomMqttClient.receive(long)method, while this handle gives application code a comfortable and readable way to unsubscribe the same Topic Filter later.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetTopicFilter()Returns the Topic Filter associated with this handle.booleanisActive()Returns whether this handle still represents an active local subscription request.MqttUnsubscribeResultunsubscribe()Unsubscribes the Topic Filter represented by this handle.
-
-
-
Method Detail
-
getTopicFilter
String getTopicFilter()
Returns the Topic Filter associated with this handle.- Returns:
- MQTT Topic Filter that was used for the subscription
-
isActive
boolean isActive()
Returns whether this handle still represents an active local subscription request.The flag is maintained by the high-level handle itself. It becomes
falseafterunsubscribe()succeeds or when the handle was already unsubscribed through the same high-level object. It does not poll the broker and therefore should be treated as local handle state, not as a broker-side session inspection API.- Returns:
truewhile the handle has not been unsubscribed through this high-level object
-
unsubscribe
MqttUnsubscribeResult unsubscribe()
Unsubscribes the Topic Filter represented by this handle.The first call delegates to the underlying
PlccomMqttClient.unsubscribe(String)operation. Later calls are treated as local no-ops so cleanup code can safely call this method more than once.- Returns:
- result describing the Topic Filter and whether a network UNSUBSCRIBE request was sent by this call
-
-