feature: Outbox Relay and Kafka Pipeline
This commit is contained in:
@@ -116,7 +116,7 @@ public class ObservationService : IObservationService
|
||||
severity = alert.Severity.ToDbString(),
|
||||
triggeredAt = alert.TriggeredAt,
|
||||
partitionKey = encounterId.ToString()
|
||||
}));
|
||||
}, encounterId.ToString()));
|
||||
}
|
||||
|
||||
// Step 7 — outbox event for the observation (always; Kafka consumer handles warnings)
|
||||
@@ -131,7 +131,7 @@ public class ObservationService : IObservationService
|
||||
source = req.Source.ToDbString(),
|
||||
recordedAt = req.RecordedAt,
|
||||
partitionKey = encounterId.ToString()
|
||||
}));
|
||||
}, encounterId.ToString()));
|
||||
|
||||
// Step 8 — COMMIT
|
||||
await _db.SaveChangesAsync();
|
||||
@@ -202,11 +202,12 @@ public class ObservationService : IObservationService
|
||||
return $"{req.ObservationCode} value {req.Value} {req.Unit} is above critical high of {t.CriticalHigh} {req.Unit}.";
|
||||
}
|
||||
|
||||
private static OutboxEvent BuildOutboxEvent(string topic, object payload) => new()
|
||||
private static OutboxEvent BuildOutboxEvent(string topic, object payload, string partitionKey) => new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Topic = topic,
|
||||
Payload = JsonSerializer.Serialize(payload),
|
||||
PartitionKey = partitionKey,
|
||||
CreatedAt = DateTimeOffset.UtcNow
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user