From e88666f1503938dc4013c68658aa808679b5be28 Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 29 Mar 2018 22:28:41 +0900 Subject: [PATCH] ing --- kafka.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 kafka.go diff --git a/kafka.go b/kafka.go new file mode 100644 index 0000000..07d70fa --- /dev/null +++ b/kafka.go @@ -0,0 +1,38 @@ +package config + +import "time" + +type Kafka struct { + 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"` +}