Unable to create an ephemeral pull consumer
See original GitHub issueDefect
I am trying to create a pull subscription with ephemeral consumer using the following code:
var cc = ConsumerConfiguration.Builder()
.WithMaxAckPending(20)
.WithAckWait(Duration.OfSeconds(40))
.WithMaxDeliver(1)
.WithReplayPolicy(ReplayPolicy.Instant)
.WithFilterSubject("auditevents")
.Build();
jetStreamManagementContext.AddOrUpdateConsumer("auditevents", cc);
The JetStreamManagement.AddOrUpdateConsumer
always verifies if Durable
name is set and it is impossible to create an ephemeral consumer using any other method from JetStreamManagement.
public ConsumerInfo AddOrUpdateConsumer(
string streamName,
ConsumerConfiguration config)
{
Validator.ValidateStreamName(streamName, true);
Validator.ValidateNotNull((object) config, nameof (config));
Validator.ValidateNotNull(config.Durable, "Durable");
return this.AddOrUpdateConsumerInternal(streamName, config);
}
Versions of NATS.Client
and nats-server
:
Client: 0.14.6 Server: 2.8.4
OS/Container environment:
MacOs Monterey
Expected result:
Possibility to create a Jetstream pull subscription with ephemeral consumer.
Actual result:
System.ArgumentNullException: Value cannot be null. (Parameter 'Durable')
at NATS.Client.Internals.Validator.ValidateNotNull(String s, String fieldName)
at NATS.Client.JetStream.JetStreamManagement.AddOrUpdateConsumer(String streamName, ConsumerConfiguration config)
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Consumer Details - NATS Docs
You (automatically) create an ephemeral consumer when you call the js.Subscribe function without specifying the Durable or Bind subscription options.
Read more >Creating consumer without/wrong durable name fails #3821
A consumer is considered durable when an explicit name is set on the Durable field when creating the consumer, otherwise it is considered...
Read more >NATS by Example - Pull Consumers (Go)
A pull consumer allows for the application to fetch one or more messages on-demand using a subscription bound to the consumer. This allows...
Read more >Message still in nats limit queue after ack and term sent in Go
Here is what I believe happens in your code: When you call the SubscribeSync method, an ephemeral consumer is created, with your provided...
Read more >ConsumerConfig in nats::jetstream - Rust
Setting deliver_subject to None will cause this consumer to be “pull-based”, and will require explicit acknowledgment of each message. This is analogous in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@robertmircea I’m waiting for this PR to be merged (https://github.com/nats-io/nats.net/pull/605), then you will be able to create ephemeral pulls.
Ephemeral consumers cannot be created ahead of time using management, they can only be created during the subscribe call. Please see this example and comment out the durable: https://github.com/nats-io/nats.net/blob/master/src/Samples/JetStreamPullSubBatchSize/JetStreamPullSubBatchSize.cs