Package com.plccom.mqtt.client
Class PlccomMqttLastWill
- java.lang.Object
-
- com.plccom.mqtt.client.PlccomMqttLastWill
-
public final class PlccomMqttLastWill extends Object
Immutable MQTT Last Will configuration for a client CONNECT packet.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPlccomMqttLastWill.BuilderBuilder for immutable Last Will configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PlccomMqttLastWill.Builderbuilder(String topic)Creates a Last Will builder for the given topic name.StringgetContentType()Returns the MQTT 5 Will Content Type property.byte[]getCorrelationData()Returns a defensive copy of the MQTT 5 Will Correlation Data property.byte[]getLastWillPayload()Returns a defensive copy of the Last Will payload.LonggetMessageExpiryIntervalSeconds()Returns the MQTT 5 Will Message Expiry Interval property.BooleangetPayloadFormatUtf8()Returns the MQTT 5 Will Payload Format Indicator property.PlccomMqttQualityOfServicegetQualityOfService()Returns the requested Last Will QoS.StringgetResponseTopic()Returns the MQTT 5 Will Response Topic property.StringgetTopic()Returns the Last Will topic.List<PlccomMqttUserProperty>getUserProperties()Returns the MQTT 5 Will User Properties.LonggetWillDelayIntervalSeconds()Returns the MQTT 5 Will Delay Interval property.booleanisRetain()Returns whether the broker should retain the Last Will publication.
-
-
-
Method Detail
-
builder
public static PlccomMqttLastWill.Builder builder(String topic)
Creates a Last Will builder for the given topic name.- Parameters:
topic- MQTT topic name used for the Last Will publication- Returns:
- builder
- Throws:
NullPointerException- iftopicisnullduringPlccomMqttLastWill.Builder.build()IllegalArgumentException- iftopicis empty duringPlccomMqttLastWill.Builder.build()
-
getTopic
public String getTopic()
Returns the Last Will topic.- Returns:
- MQTT topic name used by the broker when it publishes the Will
-
getLastWillPayload
public byte[] getLastWillPayload()
Returns a defensive copy of the Last Will payload.- Returns:
- Last Will payload bytes, never
null
-
getQualityOfService
public PlccomMqttQualityOfService getQualityOfService()
Returns the requested Last Will QoS.- Returns:
- QoS level used by the broker for the Last Will publication
-
isRetain
public boolean isRetain()
Returns whether the broker should retain the Last Will publication.- Returns:
truewhen the MQTT Will Retain flag is set
-
getPayloadFormatUtf8
public Boolean getPayloadFormatUtf8()
Returns the MQTT 5 Will Payload Format Indicator property.- Returns:
Boolean.TRUEfor UTF-8 character data,Boolean.FALSEfor unspecified binary data, ornullwhen the property is omitted
-
getMessageExpiryIntervalSeconds
public Long getMessageExpiryIntervalSeconds()
Returns the MQTT 5 Will Message Expiry Interval property.- Returns:
- expiry interval in seconds, or
nullwhen omitted
-
getWillDelayIntervalSeconds
public Long getWillDelayIntervalSeconds()
Returns the MQTT 5 Will Delay Interval property.- Returns:
- delay interval in seconds, or
nullwhen omitted
-
getContentType
public String getContentType()
Returns the MQTT 5 Will Content Type property.- Returns:
- content type, or
nullwhen omitted
-
getResponseTopic
public String getResponseTopic()
Returns the MQTT 5 Will Response Topic property.- Returns:
- response topic, or
nullwhen omitted
-
getCorrelationData
public byte[] getCorrelationData()
Returns a defensive copy of the MQTT 5 Will Correlation Data property.- Returns:
- correlation data bytes, or
nullwhen omitted
-
getUserProperties
public List<PlccomMqttUserProperty> getUserProperties()
Returns the MQTT 5 Will User Properties.- Returns:
- immutable user-property list, never
null
-
-