Class PlccomMqttSubscription


  • public final class PlccomMqttSubscription
    extends Object
    MQTT topic filter subscription.
    • Constructor Detail

      • PlccomMqttSubscription

        public PlccomMqttSubscription​(String topicFilter,
                                      PlccomMqttQualityOfService maximumQualityOfService)
        Creates a subscription.
        Parameters:
        topicFilter - MQTT topic filter
        maximumQualityOfService - requested maximum QoS
        Throws:
        NullPointerException - if topicFilter or maximumQualityOfService is null
        IllegalArgumentException - if topicFilter is empty
      • PlccomMqttSubscription

        public PlccomMqttSubscription​(String topicFilter,
                                      PlccomMqttQualityOfService maximumQualityOfService,
                                      boolean noLocal,
                                      boolean retainAsPublished,
                                      PlccomMqttRetainHandling retainHandling)
        Creates a subscription with MQTT 5 subscription options.

        The additional flags are only valid on MQTT 5 connections. A client using MQTT 3.1.1 will reject non-default MQTT 5 options before encoding the SUBSCRIBE packet.

        Parameters:
        topicFilter - MQTT topic filter
        maximumQualityOfService - requested maximum QoS
        noLocal - true to ask the broker not to deliver messages published by the same Client Identifier
        retainAsPublished - true to ask the broker to preserve the retained flag on forwarded Application Messages
        retainHandling - retained-message replay behavior
        Throws:
        NullPointerException - if topicFilter, maximumQualityOfService or retainHandling is null
        IllegalArgumentException - if topicFilter is empty
      • PlccomMqttSubscription

        public PlccomMqttSubscription​(String topicFilter,
                                      PlccomMqttQualityOfService maximumQualityOfService,
                                      boolean noLocal,
                                      boolean retainAsPublished,
                                      PlccomMqttRetainHandling retainHandling,
                                      Integer subscriptionIdentifier)
        Creates a subscription with MQTT 5 subscription options and an optional Subscription Identifier.

        The Subscription Identifier is sent as an MQTT 5 SUBSCRIBE property. When a broker accepts it, matching MQTT 5 PUBLISH packets include the identifier so applications can map incoming messages back to the subscription that caused the delivery. The value is only valid on MQTT 5 connections and must be in the MQTT Variable Byte Integer range 1..268435455.

        Parameters:
        topicFilter - MQTT topic filter
        maximumQualityOfService - requested maximum QoS
        noLocal - true to ask the broker not to deliver messages published by the same Client Identifier
        retainAsPublished - true to ask the broker to preserve the retained flag on forwarded Application Messages
        retainHandling - retained-message replay behavior
        subscriptionIdentifier - MQTT 5 Subscription Identifier, or null to omit the property
        Throws:
        NullPointerException - if topicFilter, maximumQualityOfService or retainHandling is null
        IllegalArgumentException - if topicFilter is empty or the identifier is outside the MQTT range
    • Method Detail

      • getTopicFilter

        public String getTopicFilter()
        Returns the MQTT topic filter.
        Returns:
        topic filter passed to SUBSCRIBE
      • getMaximumQualityOfService

        public PlccomMqttQualityOfService getMaximumQualityOfService()
        Returns the maximum requested QoS for matching publishes.
        Returns:
        requested maximum QoS
      • isNoLocal

        public boolean isNoLocal()
        Returns whether MQTT 5 No Local was requested.
        Returns:
        true when the broker should not forward messages published by the same Client Identifier
      • isRetainAsPublished

        public boolean isRetainAsPublished()
        Returns whether MQTT 5 Retain As Published was requested.
        Returns:
        true when the broker should preserve the retained flag on forwarded Application Messages
      • getRetainHandling

        public PlccomMqttRetainHandling getRetainHandling()
        Returns the MQTT 5 Retain Handling option.
        Returns:
        retained-message replay behavior
      • getSubscriptionIdentifier

        public Integer getSubscriptionIdentifier()
        Returns the optional MQTT 5 Subscription Identifier.
        Returns:
        Subscription Identifier, or null when the SUBSCRIBE packet should not include the property