From 3ddc721d2789c0fc4638eba6474d78bf9e9e6528 Mon Sep 17 00:00:00 2001 From: stewartboyd119 Date: Mon, 23 Sep 2024 23:10:14 -0700 Subject: [PATCH] Added comment about preferring `hamba/avro` --- example/producer_avro/main.go | 3 +++ example/worker_avro/main.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/example/producer_avro/main.go b/example/producer_avro/main.go index c954efb..219b53f 100644 --- a/example/producer_avro/main.go +++ b/example/producer_avro/main.go @@ -38,6 +38,9 @@ func main() { log.Panic(err) } for { + // The DummyEvent type is generated using `hamba/avro` (see make). This is the preferred generation for + // `formatter=zkafka.AvroSchemaRegistry` because the underlying serializer uses the avro tags on the generated struct + // // to properly connect the schema and struct event := DummyEvent{ IntField: rand.Intn(100), StringField: randomNames[rand.Intn(len(randomNames))], diff --git a/example/worker_avro/main.go b/example/worker_avro/main.go index d70ef7b..8050c49 100644 --- a/example/worker_avro/main.go +++ b/example/worker_avro/main.go @@ -80,6 +80,10 @@ func main() { func Process(_ context.Context, msg *zkafka.Message) error { // sleep to simulate random amount of work time.Sleep(100 * time.Millisecond) + + // The DummyEvent type is generated using `hamba/avro` (see make). This is the preferred generation for + // `formatter=zkafka.AvroSchemaRegistry` because the underlying deserializer uses the avro tags on the generated struct + // to properly connect the schema and struct event := DummyEvent{} err := msg.Decode(&event) if err != nil {