Class TopicAliasingOptions


  • public class TopicAliasingOptions
    extends java.lang.Object
    Configuration for all client topic aliasing behavior.
    • Constructor Detail

      • TopicAliasingOptions

        public TopicAliasingOptions()
        Default constructor
    • Method Detail

      • withOutboundBehavior

        public TopicAliasingOptions withOutboundBehavior​(TopicAliasingOptions.OutboundTopicAliasBehaviorType behavior)
        Controls what kind of outbound topic aliasing behavior the client should attempt to use. If topic aliasing is not supported by the server, this setting has no effect and any attempts to directly manipulate the topic alias id in outbound publishes will be ignored. By default, outbound topic aliasing is disabled.
        Parameters:
        behavior - outbound topic alias behavior to use
        Returns:
        the topic aliasing options object
      • withOutboundCacheMaxSize

        public TopicAliasingOptions withOutboundCacheMaxSize​(int size)
        If outbound topic aliasing is set to LRU, this controls the maximum size of the cache. If outbound topic aliasing is set to LRU and this is zero or undefined, a sensible default is used (25). If outbound topic aliasing is not set to LRU, then this setting has no effect. The final size of the cache is determined by the minimum of this setting and the value of the topic_alias_maximum property of the received CONNACK. If the received CONNACK does not have an explicit positive value for that field, outbound topic aliasing is disabled for the duration of that connection.
        Parameters:
        size - maximum size to use for the outbound alias cache
        Returns:
        the topic aliasing options object
      • withInboundBehavior

        public TopicAliasingOptions withInboundBehavior​(TopicAliasingOptions.InboundTopicAliasBehaviorType behavior)
        Controls whether or not the client allows the broker to use topic aliasing when sending publishes. Even if inbound topic aliasing is enabled, it is up to the server to choose whether or not to use it. If left undefined, then inbound topic aliasing is disabled.
        Parameters:
        behavior - inbound topic alias behavior to use
        Returns:
        the topic aliasing options object
      • withInboundCacheMaxSize

        public TopicAliasingOptions withInboundCacheMaxSize​(int size)
        If inbound topic aliasing is enabled, this will control the size of the inbound alias cache. If inbound aliases are enabled and this is zero or undefined, then a sensible default will be used (25). If inbound aliases are disabled, this setting has no effect. Behaviorally, this value overrides anything present in the topic_alias_maximum field of the CONNECT packet options.
        Parameters:
        size - maximum size to use for the inbound alias cache
        Returns:
        the topic aliasing options object