We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// Install NuGet packages `NATS.Net` and `Microsoft.Extensions.Logging.Console`. using Microsoft.Extensions.Logging; using NATS.Client.Core; using NATS.Client.JetStream; using NATS.Client.JetStream.Models; using var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); await using var nats = new NatsConnection(new NatsOpts { LoggerFactory = loggerFactory }); var js = new NatsJSContext(nats); var stream = await js.CreateStreamAsync(new StreamConfig("EVENTS", new[] { "events.>" })); var consumer = await stream.CreateConsumerAsync(new ConsumerConfig("processor") { MaxBatch = 2 }); await foreach (var msg in consumer.FetchAsync<string>(opts: new NatsJSFetchOpts { MaxMsgs = 10, NotificationHandler = (notification, token) => { Console.WriteLine($">>>> {notification.Name}"); return Task.CompletedTask; } })) { }
Output:
info: NATS.Client.Core.NatsConnection[1001] Try to connect NATS nats://localhost:4222 info: NATS.Client.Core.Internal.NatsReadProtocolProcessor[1005] Received server info: ServerInfo { Id = NCPYXNOZUU7QDMTVSD6CCLIHR7V2NZN27KIIRACGBPAK6K5EUI5LX46X, Name = NCPYXNOZUU7QDMTVSD6CCLIHR7V2NZN27KIIRACGBPAK6K5EUI5LX46X, Version = 2.10.5, ProtocolVersion = 1, GitCommit = 0883d32, GoVersion = go1.21.4, Host = 0.0.0.0, Port = 4222, HeadersSupported = True, AuthRequired = False, TlsRequired = False, TlsVerify = False, TlsAvailable = False, MaxPayload = 1048576, JetStreamAvailable = True, ClientId = 11, ClientIp = ::1, Nonce = , Cluster = , ClusterDynamic = False, ClientConnectUrls = , WebSocketConnectUrls = , LameDuckMode = False } info: NATS.Client.Core.NatsConnection[1001] Connect succeed NATS .Net Client, NATS nats://localhost:4222 warn: NATS.Client.JetStream.Internal.NatsJSFetch[2005] Unhandled protocol message: 409 Exceeded MaxRequestBatch of 2 >>>> Timeout info: NATS.Client.Core.NatsConnection[1001] Disposing connection NATS .Net Client
consumer.FetchAsync() to throw exception and maybe a notification.
consumer.FetchAsync()
client: 2.0.0 server: 2.10.5
The text was updated successfully, but these errors were encountered:
Also other codes to consider:
409 Exceeded MaxRequestExpires of 1s
409 Exceeded MaxWaiting
409 Exceeded MaxRequestMaxBytes of 3
409 Exceeded MaxRequestBatch of 2
Maybe all 409s?
409
edit: not all 409s are terminal e.g. 409 Server Shutdown
409 Server Shutdown
Any thing starts with Exceeded Max:
Exceeded Max
➜ nats-server git:(release/v2.10.5) grep -e 'sendErr.*Exceeded Max' server/consumer.go sendErr(409, fmt.Sprintf("Exceeded MaxRequestBatch of %d", o.cfg.MaxRequestBatch)) sendErr(409, fmt.Sprintf("Exceeded MaxRequestExpires of %v", o.cfg.MaxRequestExpires)) sendErr(409, fmt.Sprintf("Exceeded MaxRequestMaxBytes of %v", o.cfg.MaxRequestMaxBytes)) sendErr(409, "Exceeded MaxWaiting")
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Observed behavior
Output:
Expected behavior
consumer.FetchAsync()
to throw exception and maybe a notification.Server and client version
client: 2.0.0
server: 2.10.5
The text was updated successfully, but these errors were encountered: