From acf44b68569f6615d373f05f92671afecb296af8 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 7 Feb 2024 14:02:22 +0100 Subject: wip --- consumer.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'consumer.go') diff --git a/consumer.go b/consumer.go index c838b0c..a8c6346 100644 --- a/consumer.go +++ b/consumer.go @@ -2,17 +2,15 @@ package main import ( "fmt" + "github.com/confluentinc/confluent-kafka-go/v2/kafka" "kafka-sandbox/util" "os" "os/signal" "syscall" "time" - - "github.com/confluentinc/confluent-kafka-go/kafka" ) func main() { - if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "Usage: %s \n", os.Args[0]) @@ -50,8 +48,13 @@ func main() { // Errors are informational and automatically handled by the consumer continue } - fmt.Printf("Consumed event from topic %s: key = %-10s value = %s\n", - *ev.TopicPartition.Topic, string(ev.Key), string(ev.Value)) + fmt.Printf("%s %s %s: %+v, key = %-10s value = %s\n", + ev.TimestampType.String(), + ev.Timestamp.String(), + *ev.TopicPartition.Topic, + ev.Headers, + string(ev.Key), + string(ev.Value)) } } -- cgit v1.2.3