feat: complete final jetstream parity transport and runtime baselines
This commit is contained in:
@@ -211,6 +211,56 @@ public static class StreamApiHandlers
|
||||
if (root.TryGetProperty("max_msgs", out var maxMsgsEl) && maxMsgsEl.TryGetInt32(out var maxMsgs))
|
||||
config.MaxMsgs = maxMsgs;
|
||||
|
||||
if (root.TryGetProperty("max_bytes", out var maxBytesEl) && maxBytesEl.TryGetInt64(out var maxBytes))
|
||||
config.MaxBytes = maxBytes;
|
||||
|
||||
if (root.TryGetProperty("max_msgs_per", out var maxMsgsPerEl) && maxMsgsPerEl.TryGetInt32(out var maxMsgsPer))
|
||||
config.MaxMsgsPer = maxMsgsPer;
|
||||
|
||||
if (root.TryGetProperty("max_age_ms", out var maxAgeMsEl) && maxAgeMsEl.TryGetInt32(out var maxAgeMs))
|
||||
config.MaxAgeMs = maxAgeMs;
|
||||
|
||||
if (root.TryGetProperty("discard", out var discardEl))
|
||||
{
|
||||
var discard = discardEl.GetString();
|
||||
if (string.Equals(discard, "new", StringComparison.OrdinalIgnoreCase))
|
||||
config.Discard = DiscardPolicy.New;
|
||||
else if (string.Equals(discard, "old", StringComparison.OrdinalIgnoreCase))
|
||||
config.Discard = DiscardPolicy.Old;
|
||||
}
|
||||
|
||||
if (root.TryGetProperty("storage", out var storageEl))
|
||||
{
|
||||
var storage = storageEl.GetString();
|
||||
if (string.Equals(storage, "file", StringComparison.OrdinalIgnoreCase))
|
||||
config.Storage = StorageType.File;
|
||||
else
|
||||
config.Storage = StorageType.Memory;
|
||||
}
|
||||
|
||||
if (root.TryGetProperty("source", out var sourceEl))
|
||||
config.Source = sourceEl.GetString();
|
||||
|
||||
if (root.TryGetProperty("sources", out var sourcesEl) && sourcesEl.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
foreach (var source in sourcesEl.EnumerateArray())
|
||||
{
|
||||
if (source.ValueKind == JsonValueKind.String)
|
||||
{
|
||||
var name = source.GetString();
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
config.Sources.Add(new StreamSourceConfig { Name = name });
|
||||
}
|
||||
else if (source.ValueKind == JsonValueKind.Object &&
|
||||
source.TryGetProperty("name", out var sourceNameEl))
|
||||
{
|
||||
var name = sourceNameEl.GetString();
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
config.Sources.Add(new StreamSourceConfig { Name = name });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (root.TryGetProperty("replicas", out var replicasEl) && replicasEl.TryGetInt32(out var replicas))
|
||||
config.Replicas = replicas;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user