Interface ModifiablePublishPacket
-
- All Superinterfaces:
PublishPacket
- All Known Subinterfaces:
ModifiableWillPublish
@DoNotImplement public interface ModifiablePublishPacket extends PublishPacket
APublishPacketthat can be modified for onward delivery.- Since:
- 4.0.0, CE 2019.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull ModifiableUserPropertiesgetUserProperties()Get the modifiableUserPropertiesof the PUBLISH packet.voidsetContentType(@Nullable String contentType)Sets the content type.voidsetCorrelationData(@Nullable ByteBuffer correlationData)Sets the correlation data.voidsetMessageExpiryInterval(long messageExpiryInterval)Sets the message expiry interval.voidsetPayload(@NotNull ByteBuffer payload)Sets the payload.voidsetPayloadFormatIndicator(@Nullable PayloadFormatIndicator payloadFormatIndicator)Sets the payload format indicator.voidsetQos(@NotNull Qos qos)This does not change the QoS to the publisher.voidsetResponseTopic(@Nullable String responseTopic)Sets the response topic.voidsetRetain(boolean retain)Sets the retain flag.voidsetTopic(@NotNull String topic)Sets the topic.-
Methods inherited from interface com.hivemq.extension.sdk.api.packets.publish.PublishPacket
getContentType, getCorrelationData, getDupFlag, getMessageExpiryInterval, getPacketId, getPayload, getPayloadFormatIndicator, getQos, getResponseTopic, getRetain, getSubscriptionIdentifiers, getTimestamp, getTopic
-
-
-
-
Method Detail
-
setQos
void setQos(@NotNull Qos qos)
This does not change the QoS to the publisher. Only for onward delivery.- Parameters:
qos- The QoS for the onward publish to subscribers.- Throws:
NullPointerException- If qos is null.IllegalArgumentException- If qos is greater than the configured maximum.- Since:
- 4.0.0, CE 2019.1
-
setRetain
void setRetain(boolean retain)
Sets the retain flag.- Parameters:
retain- The new retain flag for the publish.- Throws:
IllegalArgumentException- If set to true and retained messages are disabled by HiveMQ.- Since:
- 4.0.0, CE 2019.1
-
setTopic
void setTopic(@NotNull String topic)
Sets the topic.- Parameters:
topic- The new topic for the publish.- Throws:
NullPointerException- If the topic is null.IllegalArgumentException- If the topic is an empty string.IllegalArgumentException- If the topic is invalid for publish messages.IllegalArgumentException- If the topic length exceeds the configured length for topics. Default is 65535.- Since:
- 4.0.0, CE 2019.1
-
setPayloadFormatIndicator
void setPayloadFormatIndicator(@Nullable PayloadFormatIndicator payloadFormatIndicator)
Sets the payload format indicator.- Parameters:
payloadFormatIndicator- The new payload format indicator for the publish.- Since:
- 4.0.0, CE 2019.1
-
setMessageExpiryInterval
void setMessageExpiryInterval(long messageExpiryInterval)
Sets the message expiry interval.- Parameters:
messageExpiryInterval- The new message expiry interval for the publish.- Throws:
IllegalArgumentException- If the message expiry interval is less than zero or more than the configured maximum by HiveMQ.- Since:
- 4.0.0, CE 2019.1
-
setResponseTopic
void setResponseTopic(@Nullable String responseTopic)
Sets the response topic.- Parameters:
responseTopic- The new response topic for the publish.- Throws:
IllegalArgumentException- If the response topic is not a valid UTF-8 string.IllegalArgumentException- If the response topic exceeds the UTF-8 string length limit.- Since:
- 4.0.0, CE 2019.1
-
setCorrelationData
void setCorrelationData(@Nullable ByteBuffer correlationData)
Sets the correlation data.- Parameters:
correlationData- The new correlation data for the publish.- Since:
- 4.0.0, CE 2019.1
-
setContentType
void setContentType(@Nullable String contentType)
Sets the content type.- Parameters:
contentType- The new content type for the publish.- Throws:
IllegalArgumentException- If the content type is not a valid UTF-8 string.IllegalArgumentException- If the content type exceeds the UTF-8 string length limit.- Since:
- 4.0.0, CE 2019.1
-
setPayload
void setPayload(@NotNull ByteBuffer payload)
Sets the payload.- Parameters:
payload- The new payload for the publish.- Throws:
NullPointerException- If payload is null.- Since:
- 4.0.0, CE 2019.1
-
getUserProperties
@NotNull ModifiableUserProperties getUserProperties()
Get the modifiableUserPropertiesof the PUBLISH packet.- Specified by:
getUserPropertiesin interfacePublishPacket- Returns:
- Modifiable user properties.
- Since:
- 4.0.0, CE 2019.1
-
-