♻️ Replace normal streams with JetStream

🐛 Fix pass order didn't handled successfully
This commit is contained in:
2025-09-14 19:25:53 +08:00
parent 19bf17200d
commit 4ee387ab76
17 changed files with 213 additions and 100 deletions

View File

@@ -0,0 +1,23 @@
using NATS.Client.JetStream;
using NATS.Client.JetStream.Models;
namespace DysonNetwork.Shared.Stream;
public static class Streamer
{
public static async Task<INatsJSStream> EnsureStreamCreated(
this INatsJSContext context,
string stream,
ICollection<string>? subjects
)
{
try
{
return await context.CreateStreamAsync(new StreamConfig(stream, subjects ?? []));
}
catch (NatsJSException)
{
return await context.GetStreamAsync(stream);
}
}
}