Class PlccomMqttClientOptions.Builder

    • Method Detail

      • cleanStart

        public PlccomMqttClientOptions.Builder cleanStart​(boolean value)
        Sets the MQTT clean-start flag.
        Parameters:
        value - true to start with a clean broker session
        Returns:
        this builder
      • sessionExpiryIntervalSeconds

        public PlccomMqttClientOptions.Builder sessionExpiryIntervalSeconds​(Long value)
        Sets the MQTT 5 session expiry interval.
        Parameters:
        value - session expiry in seconds, or null to omit the MQTT 5 property
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if value is outside the MQTT unsigned 32-bit range during build()
      • password

        public PlccomMqttClientOptions.Builder password​(byte[] value)
        Sets the optional MQTT password from bytes.
        Parameters:
        value - password bytes, or null to omit the password
        Returns:
        this builder
      • password

        public PlccomMqttClientOptions.Builder password​(char[] value)
        Sets the optional MQTT password from characters.

        The password is encoded as UTF-8 bytes for MQTT transmission.

        Parameters:
        value - password characters, or null to omit the password
        Returns:
        this builder
      • enhancedAuthentication

        public PlccomMqttClientOptions.Builder enhancedAuthentication​(String method,
                                                                      byte[] initialData,
                                                                      PlccomMqttClientEnhancedAuthenticator authenticator)
        Configures MQTT 5 enhanced authentication for the CONNECT handshake.

        The method and optional initial data are sent in the CONNECT properties. The authenticator is called synchronously when the broker sends AUTH challenges before CONNACK. Slow implementations can make connect and reconnect attempts slower.

        Parameters:
        method - MQTT 5 Authentication Method to send in CONNECT
        initialData - MQTT 5 Authentication Data to send in CONNECT, or null to omit it
        authenticator - handler for broker AUTH challenges, or null when no challenge response is needed
        Returns:
        this builder
        Throws:
        NullPointerException - if method is null
        IllegalArgumentException - if method is empty during build()
      • enhancedAuthentication

        public PlccomMqttClientOptions.Builder enhancedAuthentication​(String method,
                                                                      PlccomMqttClientEnhancedAuthenticator authenticator)
        Configures MQTT 5 enhanced authentication without initial CONNECT Authentication Data.
        Parameters:
        method - MQTT 5 Authentication Method to send in CONNECT
        authenticator - handler for broker AUTH challenges, or null when no challenge response is needed
        Returns:
        this builder
        Throws:
        NullPointerException - if method is null
      • noEnhancedAuthentication

        public PlccomMqttClientOptions.Builder noEnhancedAuthentication()
        Disables MQTT 5 enhanced authentication.
        Returns:
        this builder
      • topicAliasMaximum

        public PlccomMqttClientOptions.Builder topicAliasMaximum​(int value)
        Sets the MQTT 5 Topic Alias Maximum advertised by this client.

        Use 0 to keep inbound Topic Alias support disabled. Use a positive value when this client is prepared to maintain a per-connection alias table for broker-to-client PUBLISH packets.

        Parameters:
        value - maximum accepted Topic Alias value, or 0 to disable inbound Topic Aliases
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if value is outside 0..65535 during build()
      • socketReadTimeoutMillis

        public PlccomMqttClientOptions.Builder socketReadTimeoutMillis​(int value)
        Sets the socket read timeout used while waiting for data from the broker.
        Parameters:
        value - timeout in milliseconds
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if value is outside 100..60000 during build()
      • localAddress

        public PlccomMqttClientOptions.Builder localAddress​(InetAddress value)
        Sets the optional local address for the outgoing MQTT socket.

        When set, the socket is bound to this address before connecting, so MQTT traffic leaves through the network interface that owns the address. The broker host is then resolved only to addresses of the same family (IPv4/IPv6); when the host has no such address, the connect fails with a clear error instead of silently using another interface. The binding applies to plain TCP, TLS, WebSocket and secure WebSocket transports and is re-applied on every automatic reconnect.

        Parameters:
        value - local bind address, or null when the operating system selects the outgoing interface (default)
        Returns:
        this builder
      • automaticReconnect

        public PlccomMqttClientOptions.Builder automaticReconnect​(boolean value)
        Enables or disables bounded automatic reconnect.
        Parameters:
        value - true to retry a failed operation after reconnect
        Returns:
        this builder
      • reconnectDelaysMillis

        public PlccomMqttClientOptions.Builder reconnectDelaysMillis​(long initialDelayMillis,
                                                                     long maxDelayMillis)
        Sets the reconnect backoff range.
        Parameters:
        initialDelayMillis - first reconnect delay in milliseconds
        maxDelayMillis - maximum reconnect delay in milliseconds
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if either value is not positive, or the initial delay is greater than the maximum delay during build()
      • diagnosticListener

        public PlccomMqttClientOptions.Builder diagnosticListener​(PlccomMqttDiagnosticListener value)
        Sets the optional diagnostic listener.

        The listener receives recoverable background errors, callback failures and other SDK diagnostics that are useful for logging or UI notifications. Direct operation failures are still reported by the normal checked exceptions thrown by client methods.

        Parameters:
        value - diagnostic listener, or null to ignore diagnostic events
        Returns:
        this builder