-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (24 loc) · 794 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"log"
"github.com/luansapelli/kafka-stream/clients/notification"
"github.com/luansapelli/kafka-stream/controllers"
"github.com/luansapelli/kafka-stream/environment"
"github.com/luansapelli/kafka-stream/kafka"
"github.com/luansapelli/kafka-stream/service"
)
func main() {
env, err := environment.Load()
if err != nil {
log.Fatalf("error to load environment variables - %s", err)
}
config := kafka.Config(env.Application.Name).Sarama()
producer := kafka.NewProducer(env.Kafka.Brokers, env.Kafka.Topic.Input, config)
sns := notification.NewSNS(env.AWS.SNS.ARN)
stream := service.InitStream(env, sns, config)
doneChannel := make(chan bool)
go controllers.HealthCheck()
go stream.Run(doneChannel)
producer.SendConfigMessages()
doneChannel <- true
}