Class PlccomMqttPublishMessage.Builder

    • Method Detail

      • payload

        public PlccomMqttPublishMessage.Builder payload​(byte[] value)
        Sets the publish payload.
        Parameters:
        value - payload bytes, or null to publish an empty payload
        Returns:
        this builder
      • retain

        public PlccomMqttPublishMessage.Builder retain​(boolean value)
        Sets the MQTT retain flag.
        Parameters:
        value - true to ask the broker to retain the message
        Returns:
        this builder
      • payloadFormatUtf8

        public PlccomMqttPublishMessage.Builder payloadFormatUtf8​(Boolean value)
        Sets the MQTT 5 Payload Format Indicator property.

        Use true when the payload is valid UTF-8 character data and false when the payload should be treated as unspecified binary data. Supplying null omits the property.

        Parameters:
        value - payload format hint, or null to omit the property
        Returns:
        this builder
      • payloadFormatUtf8

        public PlccomMqttPublishMessage.Builder payloadFormatUtf8()
        Declares the payload as UTF-8 character data for MQTT 5 receivers.
        Returns:
        this builder
      • payloadFormatBytes

        public PlccomMqttPublishMessage.Builder payloadFormatBytes()
        Declares the payload as unspecified binary data for MQTT 5 receivers.
        Returns:
        this builder
      • contentType

        public PlccomMqttPublishMessage.Builder contentType​(String value)
        Sets the MQTT 5 content type property.
        Parameters:
        value - content type, or null to omit the property
        Returns:
        this builder
      • messageExpiryIntervalSeconds

        public PlccomMqttPublishMessage.Builder messageExpiryIntervalSeconds​(Long value)
        Sets the MQTT 5 message expiry interval.
        Parameters:
        value - expiry interval in seconds, or null to omit the property
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if value is outside the MQTT unsigned 32-bit range
      • responseTopic

        public PlccomMqttPublishMessage.Builder responseTopic​(String value)
        Sets the MQTT 5 response topic property.

        The Response Topic is a Topic Name, not a Topic Filter. Wildcard characters are rejected later by the protocol encoder so the same configured topic limits are used as for normal PUBLISH topics.

        Parameters:
        value - response topic, or null to omit the property
        Returns:
        this builder
      • correlationData

        public PlccomMqttPublishMessage.Builder correlationData​(byte[] value)
        Sets the MQTT 5 correlation data property.
        Parameters:
        value - correlation data bytes, or null to omit the property
        Returns:
        this builder
      • subscriptionIdentifier

        public PlccomMqttPublishMessage.Builder subscriptionIdentifier​(int value)
        Adds one MQTT 5 Subscription Identifier to this message view.

        This method is primarily used for inbound messages decoded from a broker. Outbound client PUBLISH packets do not encode Subscription Identifiers because the MQTT 5 specification only allows the property on PUBLISH packets sent by a broker to a subscriber.

        Parameters:
        value - Subscription Identifier in the MQTT range 1..268435455
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if value is outside the MQTT range