Interface ModifiableConnectPacket
-
- All Superinterfaces:
ConnectPacket
public interface ModifiableConnectPacket extends ConnectPacket
A modifiable version of theConnectPacket.- Since:
- 4.2.0, CE 2020.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Optional<ModifiableWillPublish>getModifiableWillPublish()Get a modifiable instance of theWillPublishPacket.@NotNull ModifiableUserPropertiesgetUserProperties()Get the modifiableUserPropertiesof the CONNECT packet.voidsetAuthenticationData(@Nullable ByteBuffer authenticationData)Set the authentication data.voidsetAuthenticationMethod(@Nullable String authenticationMethod)Set the authentication method.voidsetCleanStart(boolean cleanStart)Set the clean start flag.voidsetClientId(@NotNull String clientId)Set the client ID.voidsetKeepAlive(int keepAlive)Set the keep alive.voidsetMaximumPacketSize(int maximumPacketSize)Set the maximum packet size.voidsetPassword(@Nullable ByteBuffer password)Set the password.voidsetReceiveMaximum(int receiveMaximum)Set the receive maximum.voidsetRequestProblemInformation(boolean requestProblemInformation)Set the request problem information.voidsetRequestResponseInformation(boolean requestResponseInformation)Set the request response information.voidsetSessionExpiryInterval(long expiryInterval)Set the expiry interval.voidsetTopicAliasMaximum(int topicAliasMaximum)Set the topic alias maximum.voidsetUserName(@Nullable String userName)Set the username.voidsetWillPublish(@Nullable WillPublishPacket willPublish)Set the will publish.-
Methods inherited from interface com.hivemq.extension.sdk.api.packets.connect.ConnectPacket
getAuthenticationData, getAuthenticationMethod, getCleanStart, getClientId, getKeepAlive, getMaximumPacketSize, getMqttVersion, getPassword, getReceiveMaximum, getRequestProblemInformation, getRequestResponseInformation, getSessionExpiryInterval, getTopicAliasMaximum, getUserName, getWillPublish
-
-
-
-
Method Detail
-
setClientId
void setClientId(@NotNull String clientId)
Set the client ID.In case the client ID is changed, future interceptors may be called by a different thread for the same client. Extensions need to ensure thread-safety for shared objects in this case. Interceptors are still called in the same order for the client.
The client ID provided by the
ClientInformationin theConnectInboundInputis not updated until allConnectInboundInterceptorfor this CONNECT are finished.- Parameters:
clientId- The new client ID of the CONNECT.- Throws:
IllegalArgumentException- If the client ID is not a valid UTF-8 string.IllegalArgumentException- If the client ID exceeds the maximum client ID length.IllegalArgumentException- If the client ID is empty.- Since:
- 4.2.0, CE 2020.1
-
setCleanStart
void setCleanStart(boolean cleanStart)
Set the clean start flag.For an MQTT 3 client clean start has the same value as clean session by default. However this MQTT 5 property can be used in the same way as for MQTT 5 client via this method.
- Parameters:
cleanStart- The new clean start flag of the CONNECT.- Since:
- 4.2.0, CE 2020.1
-
setWillPublish
void setWillPublish(@Nullable WillPublishPacket willPublish)
Set the will publish.Use
Builders.willPublish()to get theWillPublishBuilderto create a will publish. To remove a will publish set this to null.To modify the existing
WillPublishPacketusegetModifiableWillPublish().- Parameters:
willPublish- The new will publish for the CONNECT.- Since:
- 4.2.0, CE 2020.1
-
setSessionExpiryInterval
void setSessionExpiryInterval(long expiryInterval)
Set the expiry interval.For an MQTT 3 client the expiry will be 0 by default if clean session is false. This method may be used to set a custom session expiry for MQTT 3 clients.
- Parameters:
expiryInterval- The new expiry interval for the CONNECT.- Throws:
IllegalArgumentException- If the expiry interval is more than the configured maximum.- Since:
- 4.2.0, CE 2020.1
-
setKeepAlive
void setKeepAlive(int keepAlive)
Set the keep alive.- Parameters:
keepAlive- The new keep alive for the CONNECT.- Throws:
IllegalArgumentException- If the keep alive is more than the configured maximum.- Since:
- 4.2.0, CE 2020.1
-
setReceiveMaximum
void setReceiveMaximum(int receiveMaximum)
Set the receive maximum.- Parameters:
receiveMaximum- The new receive maximum for the CONNECT.- Throws:
IllegalArgumentException- If the receive maximum is less than one or more than '65535'.- Since:
- 4.2.0, CE 2020.1
-
setMaximumPacketSize
void setMaximumPacketSize(int maximumPacketSize)
Set the maximum packet size.- Parameters:
maximumPacketSize- The new maximum packet size for the CONNECT.- Throws:
IllegalArgumentException- If the maximum packet size is less than one or more than the configured maximum.- Since:
- 4.2.0, CE 2020.1
-
setTopicAliasMaximum
void setTopicAliasMaximum(int topicAliasMaximum)
Set the topic alias maximum. This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.- Parameters:
topicAliasMaximum- The new topic alias maximum for the CONNECT.- Throws:
IllegalArgumentException- If the topic alias maximum is more than '65535'.- Since:
- 4.2.0, CE 2020.1
-
setRequestResponseInformation
void setRequestResponseInformation(boolean requestResponseInformation)
Set the request response information. This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.- Parameters:
requestResponseInformation- The new request response information flag for the CONNECT.- Since:
- 4.2.0, CE 2020.1
-
setRequestProblemInformation
void setRequestProblemInformation(boolean requestProblemInformation)
Set the request problem information. This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.- Parameters:
requestProblemInformation- The new request problem information flag for the CONNECT.- Since:
- 4.2.0, CE 2020.1
-
setAuthenticationMethod
void setAuthenticationMethod(@Nullable String authenticationMethod)
Set the authentication method.- Parameters:
authenticationMethod- The new authentication method of the CONNECT.- Throws:
IllegalArgumentException- If the authentication method is not a valid UTF-8 string.- Since:
- 4.2.0, CE 2020.1
-
setAuthenticationData
void setAuthenticationData(@Nullable ByteBuffer authenticationData)
Set the authentication data.- Parameters:
authenticationData- The new authentication data of the CONNECT.- Since:
- 4.2.0, CE 2020.1
-
setUserName
void setUserName(@Nullable String userName)
Set the username.- Parameters:
userName- The new username for the CONNECT.- Since:
- 4.2.0, CE 2020.1
-
setPassword
void setPassword(@Nullable ByteBuffer password)
Set the password.- Parameters:
password- The new password for the CONNECT.- Since:
- 4.2.0, CE 2020.1
-
getUserProperties
@NotNull ModifiableUserProperties getUserProperties()
Get the modifiableUserPropertiesof the CONNECT packet.- Specified by:
getUserPropertiesin interfaceConnectPacket- Returns:
- Modifiable user properties.
- Since:
- 4.2.0, CE 2020.1
-
getModifiableWillPublish
@NotNull Optional<ModifiableWillPublish> getModifiableWillPublish()
Get a modifiable instance of theWillPublishPacket.- Returns:
- Modifiable will publish.
- Since:
- 4.2.0, CE 2020.1
-
-