Skip to content

Commit

Permalink
subscribe options name handling vs 2.8.4 (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottf authored Oct 12, 2023
1 parent dc86b36 commit e346312
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/NATS.Client/JetStream/SubscribeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ protected SubscribeOptions(ISubscribeOptionsBuilder builder, bool pull,

// read the consumer names and do basic validation
// A1. validate name input
string temp = ValidateMustMatchIfBothSupplied(builder.Name, builder.Cc?.Name, JsSoNameMismatch);
string ccName = ValidateMustMatchIfBothSupplied(builder.Name, builder.Cc?.Name, JsSoNameMismatch);
// B1. Must be a valid consumer name if supplied
temp = ValidateConsumerName(temp, false);
ccName = ValidateConsumerName(ccName, false);

// A2. validate durable input
string durable = ValidateMustMatchIfBothSupplied(builder.Durable, builder.Cc?.Durable, JsSoDurableMismatch);
string ccDurable = ValidateMustMatchIfBothSupplied(builder.Durable, builder.Cc?.Durable, JsSoDurableMismatch);
// B2. Must be a valid consumer name if supplied
durable = ValidateDurable(durable, false);
ccDurable = ValidateDurable(ccDurable, false);

// C. name must match durable if both supplied
Name = ValidateMustMatchIfBothSupplied(temp, durable, JsConsumerNameDurableMismatch);
Name = ValidateMustMatchIfBothSupplied(ccName, ccDurable, JsConsumerNameDurableMismatch);

if (Bind && Name == null) {
throw JsSoNameOrDurableRequiredForBind.Instance();
Expand All @@ -98,7 +98,7 @@ protected SubscribeOptions(ISubscribeOptionsBuilder builder, bool pull,
if (Ordered)
{
ValidateNotSupplied(deliverGroup, JsSoOrderedNotAllowedWithDeliverGroup);
ValidateNotSupplied(durable, JsSoOrderedNotAllowedWithDurable);
ValidateNotSupplied(ccDurable, JsSoOrderedNotAllowedWithDurable);
ValidateNotSupplied(deliverSubject, JsSoOrderedNotAllowedWithDeliverSubject);
bool? ms = builder.Cc?._memStorage;
if (ms != null && !ms.Value)
Expand Down Expand Up @@ -135,7 +135,7 @@ protected SubscribeOptions(ISubscribeOptionsBuilder builder, bool pull,
.WithAckPolicy(AckPolicy.None)
.WithMaxDeliver(1)
.WithAckWait(Duration.OfHours(22))
.WithName(Name)
.WithName(ccName)
.WithMemStorage(true)
.WithNumReplicas(1);

Expand All @@ -149,10 +149,10 @@ protected SubscribeOptions(ISubscribeOptionsBuilder builder, bool pull,
else
{
ConsumerConfiguration = Builder(builder.Cc)
.WithDurable(durable)
.WithName(ccName)
.WithDurable(ccDurable)
.WithDeliverSubject(deliverSubject)
.WithDeliverGroup(deliverGroup)
.WithName(Name)
.Build();
}
}
Expand Down

0 comments on commit e346312

Please sign in to comment.