ing
This commit is contained in:
parent
f9345b120c
commit
1b5760425f
|
@ -1,3 +1,4 @@
|
|||
package: git.loafle.net/overflow/probe-consumer-metric
|
||||
import:
|
||||
- package: github.com/segmentio/kafka-go
|
||||
- package: git.loafle.net/commons_go/logging
|
||||
|
|
43
main.go
43
main.go
|
@ -1,5 +1,46 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"git.loafle.net/commons_go/logging"
|
||||
"git.loafle.net/overflow/probe-consumer-metric/consumer"
|
||||
)
|
||||
|
||||
func init() {
|
||||
logging.InitializeLogger("")
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer logging.Logger().Sync()
|
||||
|
||||
var c consumer.Consumer
|
||||
|
||||
go func() {
|
||||
c = consumer.New()
|
||||
if err := c.Start(); err != nil {
|
||||
logging.Logger().Error(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
|
||||
// // Set up channel on which to send signal notifications.
|
||||
// // We must use a buffered channel or risk missing the signal
|
||||
// // if we're not ready to receive when the signal is sent.
|
||||
interrupt := make(chan os.Signal, 1)
|
||||
signal.Notify(interrupt,
|
||||
syscall.SIGKILL,
|
||||
syscall.SIGSTOP,
|
||||
syscall.SIGHUP,
|
||||
syscall.SIGINT,
|
||||
syscall.SIGTERM,
|
||||
syscall.SIGQUIT)
|
||||
|
||||
<-interrupt
|
||||
|
||||
if err := c.Stop(); err != nil {
|
||||
logging.Logger().Errorf("Consumer error: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user