Skip to content

Commit

Permalink
Add messages.max.bytes proprety
Browse files Browse the repository at this point in the history
  • Loading branch information
ldechoux committed Aug 28, 2024
1 parent a069602 commit df8b5a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type Kafka struct {
Topic string `config:"KAFKA_TOPIC"`
ProduceChannelSize int `config:"KAFKA_PRODUCE_CHANNEL_SIZE"`
WithDecorators bool `config:"KAFKA_WITH_DECORATORS"`
MessageMaxBytes int `config:"KAFKA_MESSAGE_MAX_BYTES"`
}

// NewBase returns a new base configuration
Expand Down Expand Up @@ -107,6 +108,7 @@ func NewBase(ctx context.Context, configPrefix string) *Base {
Topic: "kafka-mongo-watcher",
ProduceChannelSize: 10000,
WithDecorators: true,
MessageMaxBytes: 1024 * 1024,
},
}

Expand Down
1 change: 1 addition & 0 deletions internal/service/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func (container *Container) GetKafkaProducer() *kafkaconfluent.Producer {
producer, err := kafkaconfluent.NewProducer(&kafkaconfluent.ConfigMap{
"bootstrap.servers": container.Cfg.Kafka.BootstrapServers,
"go.produce.channel.size": container.Cfg.Kafka.ProduceChannelSize,
"message.max.bytes": container.Cfg.Kafka.MessageMaxBytes,
})
if err != nil {
panic(err)
Expand Down

0 comments on commit df8b5a4

Please sign in to comment.