feat: enforce jetstream retention and limits

This commit is contained in:
Joseph Doherty
2026-02-23 06:04:23 -05:00
parent 95691fa9e7
commit d73e7e2f88
6 changed files with 107 additions and 8 deletions

View File

@@ -11,19 +11,14 @@ public sealed class JetStreamPublisher
public bool TryCapture(string subject, ReadOnlyMemory<byte> payload, out PubAck ack)
{
var stream = _streamManager.FindBySubject(subject);
if (stream == null)
var captured = _streamManager.Capture(subject, payload);
if (captured == null)
{
ack = new PubAck();
return false;
}
var seq = stream.Store.AppendAsync(subject, payload, default).GetAwaiter().GetResult();
ack = new PubAck
{
Stream = stream.Config.Name,
Seq = seq,
};
ack = captured;
return true;
}