Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
scottf committed Sep 19, 2023
1 parent 605064f commit 75aa678
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/main/java/io/nats/client/JetStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ public interface JetStream {
* <p>See {@link io.nats.client.Connection#createDispatcher(MessageHandler) createDispatcher} for
* information about creating an asynchronous subscription with callbacks.
*
* @param subscribeSubject the subject to subscribe to
* @param subscribeSubject the subject to subscribe to.
* Can be null or empty when the options have a ConsumerConfiguration that supplies a filter subject.
* @param options optional subscription options
* @return The subscription
* @throws IOException covers various communication issues with the NATS
Expand All @@ -394,6 +395,7 @@ public interface JetStream {
* information about creating an asynchronous subscription with callbacks.
*
* @param subscribeSubject the subject to subscribe to
* Can be null or empty when the options have a ConsumerConfiguration that supplies a filter subject.
* @param queue the optional queue group to join
* @param options optional subscription options
* @return The subscription
Expand Down Expand Up @@ -424,6 +426,7 @@ public interface JetStream {
* specified dispatcher. Since a MessageHandler is also required, the Dispatcher will
* not prevent duplicate subscriptions from being made.
* @param subscribeSubject The subject to subscribe to.
* Can be null or empty when the options have a ConsumerConfiguration that supplies a filter subject.
* @param dispatcher The dispatcher to handle this subscription
* @param handler The target for the messages
* @param autoAck Whether to auto ack
Expand All @@ -441,6 +444,7 @@ public interface JetStream {
* not prevent duplicate subscriptions from being made.
*
* @param subscribeSubject The subject to subscribe to.
* Can be null or empty when the options have a ConsumerConfiguration that supplies a filter subject.
* @param queue the optional queue group to join
* @param dispatcher The dispatcher to handle this subscription
* @param handler The target for the messages
Expand All @@ -456,6 +460,7 @@ public interface JetStream {
/**
* Create a subscription to the specified subject in the mode of pull, with additional options
* @param subscribeSubject The subject to subscribe to
* Can be null or empty when the options have a ConsumerConfiguration that supplies a filter subject.
* @param options pull subscription options
* @return The subscription
* @throws IOException covers various communication issues with the NATS
Expand All @@ -467,6 +472,7 @@ public interface JetStream {
/**
* Create an asynchronous subscription to the specified subject in the mode of pull, with additional options
* @param subscribeSubject The subject to subscribe to
* Can be null or empty when the options have a ConsumerConfiguration that supplies a filter subject.
* @param dispatcher The dispatcher to handle this subscription
* @param handler The target for the messages
* @param options pull subscription options
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/nats/client/impl/NatsJetStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ JetStreamSubscription createSubscription(String userSubscribeSubject,
// 2. figure out user provided subjects and prepare the userCcFilterSubjects
userSubscribeSubject = emptyAsNull(userSubscribeSubject);
List<String> userCcFilterSubjects = new ArrayList<>();
if (userCC.getFilterSubject() == null) { // empty filterSubjects gives gives null
if (userCC.getFilterSubject() == null) { // empty filterSubjects gives null
// userCC.filterSubjects empty, populate userCcFilterSubjects w/userSubscribeSubject if possible
if (userSubscribeSubject != null) {
userCcFilterSubjects.add(userSubscribeSubject);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/nats/client/impl/NatsJetStreamImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ ConsumerInfo _createConsumer(String streamName, ConsumerConfiguration config) th

String durable = config.getDurable();
String subj;
// new consumer create not available before 290 and can't be used with multiple filter subjects
if (consumerCreate290Available && !multipleFilterSubject) {
if (consumerName == null) {
// if both consumerName and durable are null, generate a name
Expand Down

0 comments on commit 75aa678

Please sign in to comment.