From cc2bef72c8fc601c720eb708a45142ec7e7975dd Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 8 May 2018 12:05:07 +0900 Subject: [PATCH] ing --- config/external/kafka.go | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/config/external/kafka.go b/config/external/kafka.go index 53fa7fb..9b99c22 100644 --- a/config/external/kafka.go +++ b/config/external/kafka.go @@ -1,6 +1,38 @@ package external +import "time" + type Kafka struct { - Network string `json:"network,omitempty"` - Address string `json:"address,omitempty"` + Consumers map[string]*KafkaConsumer `json:"consumers" yaml:"consumers" toml:"consumers"` + Producers map[string]*KafkaProducer `json:"producers" yaml:"producers" toml:"producers"` +} + +type KafkaProducer struct { + Brokers []string `json:"brokers" yaml:"brokers" toml:"brokers"` + Topic string `json:"topic" yaml:"topic" toml:"topic"` + MaxAttempts int `json:"maxAttempts" yaml:"maxAttempts" toml:"maxAttempts"` + QueueCapacity int `json:"queueCapacity" yaml:"queueCapacity" toml:"queueCapacity"` + BatchSize int `json:"batchSize" yaml:"batchSize" toml:"batchSize"` + BatchTimeout time.Duration `json:"batchTimeout" yaml:"batchTimeout" toml:"batchTimeout"` + ReadTimeout time.Duration `json:"readTimeout" yaml:"readTimeout" toml:"readTimeout"` + WriteTimeout time.Duration `json:"writeTimeout" yaml:"writeTimeout" toml:"writeTimeout"` + RebalanceInterval time.Duration `json:"rebalanceInterval" yaml:"rebalanceInterval" toml:"rebalanceInterval"` + RequiredAcks int `json:"requiredAcks" yaml:"requiredAcks" toml:"requiredAcks"` + Async bool `json:"async" yaml:"async" toml:"async"` +} + +type KafkaConsumer struct { + Brokers []string `json:"brokers" yaml:"brokers" toml:"brokers"` + GroupID string `json:"groupID" yaml:"groupID" toml:"groupID"` + Topic string `json:"topic" yaml:"topic" toml:"topic"` + QueueCapacity int `json:"queueCapacity" yaml:"queueCapacity" toml:"queueCapacity"` + MinBytes int `json:"minBytes" yaml:"minBytes" toml:"minBytes"` + MaxBytes int `json:"maxBytes" yaml:"maxBytes" toml:"maxBytes"` + MaxWait time.Duration `json:"maxWait" yaml:"maxWait" toml:"maxWait"` + ReadLagInterval time.Duration `json:"readLagInterval" yaml:"readLagInterval" toml:"readLagInterval"` + HeartbeatInterval time.Duration `json:"heartbeatInterval" yaml:"heartbeatInterval" toml:"heartbeatInterval"` + CommitInterval time.Duration `json:"commitInterval" yaml:"commitInterval" toml:"commitInterval"` + SessionTimeout time.Duration `json:"sessionTimeout" yaml:"sessionTimeout" toml:"sessionTimeout"` + RebalanceTimeout time.Duration `json:"rebalanceTimeout" yaml:"rebalanceTimeout" toml:"rebalanceTimeout"` + RetentionTime time.Duration `json:"retentionTime" yaml:"retentionTime" toml:"retentionTime"` }