Interface MqttSubscriptionHandle

  • All Known Implementing Classes:
    MqttSubscribeResult

    public interface MqttSubscriptionHandle
    Handle 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 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 false after unsubscribe() 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:
        true while 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