-
Notifications
You must be signed in to change notification settings - Fork 85
Add Publish Timeout on Disconnect #1001
New issue
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
base: main
Are you sure you want to change the base?
Conversation
scottf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@paagamelo2 does this work for you? |
Apologies, haven't had a chance to try this out yet. Will do between today and tomorrow! |
|
@mtmk I'm seeing the same behavior as before, despite using the new I see in your tests you wait for the reconnection loop to kick in, which I don't. The only other difference is that I'm using Testcontainers. I'd be surprised if any of that makes a difference though. This is essentially what I'm doing: [Fact]
public async Task ExperimentWithRealNats()
{
await using var nats = new NatsBuilder().Build();
await nats.StartAsync();
await using var client = new NatsClient(nats.GetConnectionString());
var js = client.CreateJetStreamContext(new NatsJSOpts(new NatsOpts
{
CommandTimeout = TimeSpan.FromSeconds(3),
PublishTimeoutOnDisconnected = true,
}));
await js.CreateStreamAsync(new StreamConfig("ORDERS", ["orders.>"]));
await nats.StopAsync();
try
{
await js.PublishAsync("orders.1", "this is my order :)");
}
catch (Exception ex)
{
Debugger.Break(); // <- never hit
}
}Do you spot anything wrong? |
|
Thanks for checking this @paagamelo2 Can you try passing the opts to client: await using var client = new NatsClient(new NatsOpts
{
Url = nats.GetConnectionString(),
CommandTimeout = TimeSpan.FromSeconds(3),
PublishTimeoutOnDisconnected = true,
});
var js = client.CreateJetStreamContext(); |
|
@mtmk cheers, that works as expected for me! |
Put behind an option to not break existing behavior.