feat: cache protocol realtime raw

This commit is contained in:
lingniu
2026-07-02 11:19:46 +08:00
parent e7d024405a
commit 3a67f6e05f
8 changed files with 304 additions and 27 deletions

View File

@@ -14,7 +14,7 @@ func TestKafkaSinkRoutesRawTopics(t *testing.T) {
writer := &recordingWriter{}
sink := newKafkaSinkWithWriter(writer, KafkaConfig{})
env := envelope.FrameEnvelope{Protocol: envelope.ProtocolJT808, Phone: "013307795425", MessageID: "0x0200"}
env := envelope.FrameEnvelope{Protocol: envelope.ProtocolJT808, Phone: "13307795425", MessageID: "0x0200"}
if err := sink.PublishRaw(context.Background(), env); err != nil {
t.Fatalf("PublishRaw() error = %v", err)
}
@@ -25,7 +25,7 @@ func TestKafkaSinkRoutesRawTopics(t *testing.T) {
if msg.Topic != "vehicle.raw.jt808.v1" {
t.Fatalf("topic = %q", msg.Topic)
}
if string(msg.Key) != "JT808:013307795425" {
if string(msg.Key) != "JT808:13307795425" {
t.Fatalf("key = %q", string(msg.Key))
}
var decoded envelope.FrameEnvelope