You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/io/nats/client/MessageTtl.java
+13-10
Original file line number
Diff line number
Diff line change
@@ -15,26 +15,29 @@
15
15
16
16
importio.nats.client.support.Validator;
17
17
18
+
/**
19
+
* Class to make setting a per message ttl easier.
20
+
*/
18
21
publicclassMessageTtl {
19
-
privatefinalStringmessageTtl;
22
+
privatefinalStringttlString;
20
23
21
-
privateMessageTtl(StringmessageTtl) {
22
-
this.messageTtl = messageTtl;
24
+
privateMessageTtl(StringttlString) {
25
+
this.ttlString = ttlString;
23
26
}
24
27
25
-
publicStringgetMessageTtl() {
26
-
returnmessageTtl;
28
+
publicStringgetTtlString() {
29
+
returnttlString;
27
30
}
28
31
29
32
@Override
30
33
publicStringtoString() {
31
-
return"MessageTtl{'" + messageTtl + "'}";
34
+
return"MessageTtl{'" + ttlString + "'}";
32
35
}
33
36
34
37
/**
35
38
* Sets the TTL for this specific message to be published
36
39
* @param msgTtlSeconds the ttl in seconds
37
-
* @return The Builder
40
+
* @return The MessageTtl instance
38
41
*/
39
42
publicstaticMessageTtlseconds(intmsgTtlSeconds) {
40
43
if (msgTtlSeconds < 1) {
@@ -47,18 +50,18 @@ public static MessageTtl seconds(int msgTtlSeconds) {
47
50
* Sets the TTL for this specific message to be published. Use at your own risk.
48
51
* The current specification can be found here @see <a href="https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-43.md#per-message-ttl">JetStream Per-Message TTL</a>
@@ -268,7 +268,8 @@ public Builder messageId(String msgId) {
268
268
}
269
269
270
270
/**
271
-
* Sets the TTL for this specific message to be published
271
+
* Sets the TTL for this specific message to be published.
272
+
* Less than 1 has the effect of clearing the message ttl
272
273
* @param msgTtlSeconds the ttl in seconds
273
274
* @return The Builder
274
275
*/
@@ -280,11 +281,12 @@ public Builder messageTtlSeconds(int msgTtlSeconds) {
280
281
/**
281
282
* Sets the TTL for this specific message to be published. Use at your own risk.
282
283
* The current specification can be found here @see <a href="https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-43.md#per-message-ttl">JetStream Per-Message TTL</a>
283
-
* @param messageTtlCustom the ttl in seconds
284
+
* Null or empty has the effect of clearing the message ttl
0 commit comments