feat: split history and analytics consumers

This commit is contained in:
lingniu
2026-06-23 17:43:28 +08:00
parent f9aa214dc2
commit 6a8b53bab6
6 changed files with 143 additions and 13 deletions

View File

@@ -17,7 +17,11 @@ public final class VehicleStateEnvelopeIngestor implements EnvelopeIngestor {
}
public void ingest(byte[] kafkaValue) {
updater.update(parse(kafkaValue));
VehicleEnvelope envelope = parse(kafkaValue);
if (!envelope.hasTelemetrySnapshot()) {
return;
}
updater.update(envelope);
}
@Override
@@ -25,6 +29,10 @@ public final class VehicleStateEnvelopeIngestor implements EnvelopeIngestor {
VehicleEnvelope envelope = null;
try {
envelope = parse(kafkaValue);
if (!envelope.hasTelemetrySnapshot()) {
return EnvelopeIngestResult.skipped(
envelope.getEventId(), envelope.getVin(), "envelope telemetry_snapshot is required");
}
// Kafka 消费路径只接受标准 VehicleEnvelope坏消息返回明确结果给处理器写 DLQ。
updater.update(envelope);
return EnvelopeIngestResult.processed(envelope.getEventId(), envelope.getVin());