Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Initial kafka clusters.yaml config
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Bailey committed Apr 7, 2017
1 parent 1238704 commit 38f3f1a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
9 changes: 9 additions & 0 deletions common/configure/commonappconfig.go
Expand Up @@ -30,6 +30,7 @@ type AppConfig struct {
FrontendConfig *FrontendConfig `yaml:"FrontendConfig"`
StorageConfig *StorageConfig `yaml:"StorageConfig"`
ReplicatorConfig *ReplicatorConfig `yaml:"ReplicatorConfig"`
KafkaConfig *KafkaConfig `yaml:"KafkaConfig"`

DefaultDestinationConfig *DestinationConfig `yaml:"DefaultDestinationConfig"`
}
Expand All @@ -46,6 +47,7 @@ func NewCommonAppConfig() CommonAppConfig {
StorageConfig: NewCommonStorageConfig(),
ReplicatorConfig: NewCommonReplicatorConfig(),
DefaultDestinationConfig: NewDestinationConfig(),
KafkaConfig: NewCommonKafkaConfig(),
}
}

Expand Down Expand Up @@ -100,3 +102,10 @@ func (r *AppConfig) SetServiceConfig(sName string, sCfg CommonServiceConfig) {
func (r *AppConfig) GetDefaultServiceConfig() CommonServiceConfig {
return r.DefaultServiceConfig
}

// GetDefaultServiceConfig returns the default service config
func (r *AppConfig) GetKafkaConfig() CommonKafkaConfig {
return r.KafkaConfig
}


41 changes: 41 additions & 0 deletions common/configure/commonkafkaconfig.go
@@ -0,0 +1,41 @@
// Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package configure

// KafkaConfig holds the configuration for the Kafka client
type KafkaConfig struct {
kafkaClusterConfigFile string `yaml:kafkaClusterConfigFile`
}

type clustersConfig struct {
clusters []cluster `yaml:clusters`
}

type cluster struct {
brokers []string `yaml:brokers`
zookeepers []string `yaml:zookeepers`
chroot string `yaml:chroot`
}

// NewCommonKafkaConfig instantiates a Kafka config
func NewCommonKafkaConfig() *KafkaConfig {
return &KafkaConfig{}
}
3 changes: 3 additions & 0 deletions common/configure/interfaces.go
Expand Up @@ -222,4 +222,7 @@ type (
// GetReplicas returns the no: of replicas to be used for destinations
GetReplicas() int16
}

// CommonKafkaConfig holds the Kafka-related config
CommonKafkaConfig interface{}
)

0 comments on commit 38f3f1a

Please sign in to comment.