Add Publish Timeout on Disconnect#1001
Merged
Merged
Conversation
Member
Author
|
@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? |
Member
Author
|
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! |
mtmk
added a commit
that referenced
this pull request
Dec 11, 2025
* Add prioritized mode (#1011) * Add Publish Timeout on Disconnect (#1001) * Fix test flap (#1012) * Add test to promote mirrored to regular stream (#1008) * Add Nats-Expected-Last-Subject-Sequence-Subject (#1007) * Fix keyed NATS clients with configurations (#1006) * ensure NatsConnectionPool cannot overflow (#1005) * Fix stream config adjustments on update (#995) * Handel Unobserved Exceptions During Connection State Transitions (#999) * Added verification of the consumer sequence number for pull ordered consumers (#981) * Fix build warnings (#991) * Reduce closure allocations (#988)
Merged
mtmk
added a commit
that referenced
this pull request
Dec 11, 2025
* Add prioritized mode (#1011) * Add Publish Timeout on Disconnect (#1001) * Fix test flap (#1012) * Add test to promote mirrored to regular stream (#1008) * Add Nats-Expected-Last-Subject-Sequence-Subject (#1007) * Fix keyed NATS clients with configurations (#1006) * ensure NatsConnectionPool cannot overflow (#1005) * Fix stream config adjustments on update (#995) * Handel Unobserved Exceptions During Connection State Transitions (#999) * Added verification of the consumer sequence number for pull ordered consumers (#981) * Fix build warnings (#991) * Reduce closure allocations (#988)
This was referenced Dec 15, 2025
This was referenced Mar 2, 2026
This was referenced Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Put behind an option to not break existing behavior.