This commit is contained in:
crusader 2018-03-29 22:28:41 +09:00
parent 79424c10e4
commit e88666f150

38
kafka.go Normal file
View File

@ -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"`
}