cleanup
This commit is contained in:
25
main.go
25
main.go
@@ -7,7 +7,6 @@ import (
|
||||
server "com.navi.medici.janus/server"
|
||||
producer_module "com.navi.medici.janus/producer"
|
||||
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"github.com/spf13/viper"
|
||||
@@ -27,14 +26,15 @@ func init() {
|
||||
|
||||
var configuration config.Configurations
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
fmt.Printf("Error reading config file, %s", err)
|
||||
log.Fatalln("Error reading config file, %s", err)
|
||||
}
|
||||
|
||||
err := viper.Unmarshal(&configuration)
|
||||
if err != nil {
|
||||
fmt.Printf("Unable to decode into struct, %v", err)
|
||||
log.Fatalln("Unable to decode into struct, %v", err)
|
||||
}
|
||||
|
||||
// Following coinfigurations read from environment variables
|
||||
configuration.Kafka.Bootstrap_Servers = viper.GetString(configuration.Kafka.Bootstrap_Servers)
|
||||
configuration.Kafka.Sasl_User = viper.GetString(configuration.Kafka.Sasl_User)
|
||||
configuration.Kafka.Sasl_Password = viper.GetString(configuration.Kafka.Sasl_Password)
|
||||
@@ -45,31 +45,18 @@ func init() {
|
||||
port = configuration.Server.Port
|
||||
log.Printf("PORT IS: ", port)
|
||||
log.Printf(configuration.Kafka.Bootstrap_Servers)
|
||||
log.Printf(configuration.Kafka.Sasl_User)
|
||||
log.Printf(configuration.Kafka.Sasl_Password)
|
||||
log.Printf(configuration.SchemaRegistry.Endpoint)
|
||||
|
||||
// initialize schema version map which contains latest schema version for topic(s)
|
||||
producer_module.GetSchemaVersions(configuration.SchemaRegistry.Endpoint, strings.Split(configuration.SchemaRegistry.Topics, ","))
|
||||
|
||||
// initialize producers
|
||||
producer_module.InitializeProducers(configuration.Kafka)
|
||||
|
||||
// TO DO: read number of goroutines from config
|
||||
for i := 0; i < configuration.Server.Goroutines; i++ {
|
||||
go lib.ProcessRequestChannel(configuration.Server.Kafka_Topic)
|
||||
}
|
||||
|
||||
// sync producer using sarama
|
||||
// sync_producer := producer_module.GetSyncProducer(configuration.Kafka)
|
||||
// log.Println(sync_producer)
|
||||
// producer_module.KafkaWriter(sync_producer, topic, messageToSendBytes)
|
||||
// sync_producer.Close()
|
||||
|
||||
// async producer using sarama
|
||||
// async_producer := producer_module.GetAsyncProducer(configuration.Kafka)
|
||||
// log.Println(async_producer)
|
||||
// producer_module.KafkaWriter(async_producer)
|
||||
// async_producer.Close()
|
||||
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user