diff --git a/build/docker/docker-compose.yaml b/build/docker/docker-compose.yaml index 53596c7..4c1bf6f 100644 --- a/build/docker/docker-compose.yaml +++ b/build/docker/docker-compose.yaml @@ -55,6 +55,7 @@ services: image: zookeeper:3.4.14 ports: - "2181" + platform: "linux/x86_64" jaeger: image: jaegertracing/all-in-one:1.22 container_name: ${APP_PROJECT}_jaeger diff --git a/cmd/cmd_consume.go b/cmd/cmd_consume.go index fc97fdb..1272ffc 100644 --- a/cmd/cmd_consume.go +++ b/cmd/cmd_consume.go @@ -18,6 +18,7 @@ func NewConsumeCmd() *cobra.Command { groupFlag string topicsFlag []string countFlag int + noCommit bool ) cmd := &cobra.Command{ @@ -37,6 +38,9 @@ func NewConsumeCmd() *cobra.Command { return } + if noCommit { + kafkaConfig.Consumer.Offsets.AutoCommit.Enable = false + } // consumer consumer, err := kafka.NewConsumerGroup(viper.GetStringSlice("broker"), groupFlag, kafkaConfig) if err != nil { @@ -77,6 +81,7 @@ func NewConsumeCmd() *cobra.Command { flags.StringVarP(&groupFlag, "group", "G", "", "Consumer group") flags.StringSliceVarP(&topicsFlag, "topic", "t", []string{}, "Topic to consume from") flags.IntVarP(&countFlag, "count", "c", 0, "Exit after consuming this number of messages") + flags.BoolVar(&noCommit, "no-commit", false, "Consume messages without commiting offset") _ = cmd.MarkFlagRequired("group") _ = cmd.MarkFlagRequired("topic")