Skip to content

Commit 1962352

Browse files
authored
NoWait documentation (#1256)
1 parent a76dd02 commit 1962352

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/java/io/nats/client/FetchConsumeOptions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public Builder max(int maxBytes, int maxMessages) {
9696

9797
/**
9898
* Set no wait to true
99+
* When no wait is true, the fetch will return immediately with as many messages as are available. Between zero and the maximum configured.
99100
* @return the builder
100101
*/
101102
@Override
@@ -106,7 +107,9 @@ public Builder noWait() {
106107
}
107108

108109
/**
109-
* Set no wait to true with an expiration, special behavior.
110+
* Set no wait to true with an expiration. This is the common configuration to receive messages as soon as they arrive in the stream without excessive pulling.
111+
* When no wait is true with expire, the fetch will return immediately with as many messages as are available, but at least one message. Between one and the maximum configured.
112+
* When no message is available it will wait for new messages to arrive till it expires.
110113
* @param expiresInMillis the expiration time in milliseconds
111114
* @return the builder
112115
*/

src/main/java/io/nats/client/JetStreamSubscription.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public interface JetStreamSubscription extends Subscription {
5353

5454
/**
5555
* Initiate pull in noWait mode with the specified batch size.
56-
*
56+
* The fetch will return immediately with as many messages as are available. Between zero and the maximum configured.
5757
* ! Pull subscriptions only. Push subscription will throw IllegalStateException
5858
* ! Primitive API for ADVANCED use only, officially not supported. Prefer fetch, iterate or reader.
5959
*
@@ -64,6 +64,8 @@ public interface JetStreamSubscription extends Subscription {
6464

6565
/**
6666
* Initiate pull in noWait mode with the specified batch size.
67+
* The fetch will return immediately with as many messages as are available, but at least one message. Between one and the maximum configured.
68+
* When no message is available it will wait for new messages to arrive till it expires.
6769
* ! Pull subscriptions only. Push subscription will throw IllegalStateException
6870
* ! Primitive API for ADVANCED use only, officially not supported. Prefer fetch, iterate or reader.
6971
*
@@ -75,6 +77,8 @@ public interface JetStreamSubscription extends Subscription {
7577

7678
/**
7779
* Initiate pull in noWait mode with the specified batch size.
80+
* The fetch will return immediately with as many messages as are available, but at least one message. Between one and the maximum configured.
81+
* When no message is available it will wait for new messages to arrive till it expires.
7882
* ! Pull subscriptions only. Push subscription will throw IllegalStateException
7983
* ! Primitive API for ADVANCED use only, officially not supported. Prefer fetch, iterate or reader.
8084
*

0 commit comments

Comments
 (0)