Closed Lemorz56 closed 2 years ago
Thank you for the complete bug report, this is just a bug, you are using it correct. I fixed it here, https://github.com/nats-io/nats.net/pull/663 and checked the external object before trying to add it to the json. I will make a pre-release as soon as this is merged since I don't want to do a full release until I finish something else I'm working on, but it should only be a few more days.
This fix is available in a pre-release. https://www.nuget.org/packages/NATS.Client/0.14.9-pre3
This fix is available in a pre-release. https://www.nuget.org/packages/NATS.Client/0.14.9-pre3
Thanks a lot for your quick reply and your fix 👍🏼.
Defect
Make sure that these boxes are checked before submitting your issue -- thank you!
Versions of
NATS.Client
andnats-server
:OS/Container environment:
Steps or code to reproduce the issue:
Using NATS.Client, build two streams, one with the first stream as source but do not add WithExternal to the source like so:
var cf = new ConnectionFactory(); var con = cf.CreateConnection("nats://localhost:4223");
var jsm = con.CreateJetStreamManagementContext();
var streamBuilder = new StreamConfiguration.StreamConfigurationBuilder(); var streamBuilderTwo = new StreamConfiguration.StreamConfigurationBuilder();
var streamOne = streamBuilder .WithName("test") .WithSubjects(new string[] { "test.sub" }) .Build();
var sourceTest = new Source.SourceBuilder() .WithName("test") .WithFilterSubject("test.*") .WithStartSeq(0) .WithStartTime(DateTime.MinValue) .Build();
var streamTwoWithSource = streamBuilderTwo .WithName("archive") .WithSources(new Source[] { sourceTest }) .Build();
jsm.AddStream(streamOne); jsm.AddStream(streamTwoWithSource);
Actual result:
When using nats.net user is forced to supply all properties including external, leaving the user with no way to create a source without the external property.
Supplying
.WithExternal(new External("", ""))
or.WithExternal(new External(null, null))
instead creates a stream without a working source that makes thenats stream info --json
look like this:This means there is no way for me to create a working source without it being external? Maybe I'm just using it in a wrong way.