Skip to content

Commit df1a607

Browse files
authored
subscribe options name handling vs 2.8.4 (#1011)
1 parent fcf6e54 commit df1a607

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,24 @@ protected SubscribeOptions(Builder builder, boolean isPull,
5757

5858
// read the consumer names and do basic validation
5959
// A1. validate name input
60-
String temp = validateMustMatchIfBothSupplied(
60+
String ccName = validateMustMatchIfBothSupplied(
6161
builder.name,
6262
builder.cc == null ? null : builder.cc.getName(),
6363
JsSoNameMismatch);
6464
// B1. Must be a valid consumer name if supplied
65-
temp = validateConsumerName(temp, false);
65+
ccName = validateConsumerName(ccName, false);
6666

6767
// A2. validate durable input
68-
String durable = validateMustMatchIfBothSupplied(
68+
String ccDurable = validateMustMatchIfBothSupplied(
6969
builder.durable,
7070
builder.cc == null ? null : builder.cc.getDurable(),
7171
JsSoDurableMismatch);
7272

7373
// B2. Must be a valid consumer name if supplied
74-
durable = validateDurable(durable, false);
74+
ccDurable = validateDurable(ccDurable, false);
7575

7676
// C. name must match durable if both supplied
77-
name = validateMustMatchIfBothSupplied(temp, durable, JsConsumerNameDurableMismatch);
77+
name = validateMustMatchIfBothSupplied(ccName, ccDurable, JsConsumerNameDurableMismatch);
7878

7979
if (bind && name == null) {
8080
throw JsSoNameOrDurableRequiredForBind.instance();
@@ -89,7 +89,7 @@ protected SubscribeOptions(Builder builder, boolean isPull,
8989

9090
if (ordered) {
9191
validateNotSupplied(deliverGroup, JsSoOrderedNotAllowedWithDeliverGroup);
92-
validateNotSupplied(durable, JsSoOrderedNotAllowedWithDurable);
92+
validateNotSupplied(ccDurable, JsSoOrderedNotAllowedWithDurable);
9393
validateNotSupplied(deliverSubject, JsSoOrderedNotAllowedWithDeliverSubject);
9494
long hb = DEFAULT_ORDERED_HEARTBEAT;
9595
if (builder.cc != null) {
@@ -117,7 +117,7 @@ protected SubscribeOptions(Builder builder, boolean isPull,
117117
.ackPolicy(AckPolicy.None)
118118
.maxDeliver(1)
119119
.ackWait(Duration.ofHours(22))
120-
.name(name)
120+
.name(ccName)
121121
.memStorage(true)
122122
.numReplicas(1);
123123

@@ -128,10 +128,10 @@ protected SubscribeOptions(Builder builder, boolean isPull,
128128
}
129129
else {
130130
consumerConfig = ConsumerConfiguration.builder(builder.cc)
131-
.durable(durable)
131+
.name(ccName)
132+
.durable(ccDurable)
132133
.deliverSubject(deliverSubject)
133134
.deliverGroup(deliverGroup)
134-
.name(name)
135135
.build();
136136
}
137137
}

0 commit comments

Comments
 (0)