File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
src/main/java/com/hivemq/client
internal/mqtt/message/publish Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,11 @@ public abstract class MqttPublishBuilder<B extends MqttPublishBuilder<B>> {
104
104
}
105
105
106
106
public @ NotNull B messageExpiryInterval (final long messageExpiryInterval ) {
107
- this .messageExpiryInterval = Checks .unsignedInt (messageExpiryInterval , "Message expiry interval" );
107
+ if (messageExpiryInterval == -1 ) {
108
+ this .messageExpiryInterval = MqttPublish .NO_MESSAGE_EXPIRY ;
109
+ } else {
110
+ this .messageExpiryInterval = Checks .unsignedInt (messageExpiryInterval , "Message expiry interval" );
111
+ }
108
112
return self ();
109
113
}
110
114
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ public interface Mqtt5ConnectBuilderBase<B extends Mqtt5ConnectBuilderBase<B>> {
69
69
/**
70
70
* Sets the {@link Mqtt5Connect#getSessionExpiryInterval() session expiry interval} in seconds.
71
71
* <p>
72
- * The value must be in the range of an unsigned int: [0, 4_294_967_295].
72
+ * The value must be in the range of an unsigned int: [0, 4_294_967_295]. 4_294_967_295 disables session expiry.
73
73
*
74
74
* @param sessionExpiryInterval the session expiry interval in seconds.
75
75
* @return the builder.
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ interface Complete<C extends Mqtt5PublishBuilderBase.Complete<C>> extends Mqtt5P
116
116
/**
117
117
* Sets the {@link Mqtt5Publish#getMessageExpiryInterval() message expiry interval} in seconds.
118
118
* <p>
119
- * The value must be in the range of an unsigned int: [0, 4_294_967_295].
119
+ * The value must be in the range of an unsigned int: [0, 4_294_967_295] or -1 to disable message expiry .
120
120
*
121
121
* @param messageExpiryInterval the message expiry interval in seconds.
122
122
* @return the builder.
You can’t perform that action at this time.
0 commit comments