Commit 6fd29c73 authored by vicotor's avatar vicotor

add register

parent 9c004070
...@@ -81,18 +81,25 @@ func NewNode() *Node { ...@@ -81,18 +81,25 @@ func NewNode() *Node {
brokers := strings.Split(node.conf.Kafka.Brokers, ";") brokers := strings.Split(node.conf.Kafka.Brokers, ";")
node.kafkaProducer, _ = utils.NewKafkaProducer(brokers) node.kafkaProducer, _ = utils.NewKafkaProducer(brokers)
node.status = "before running" node.status = "before running"
node.register()
return node return node
} }
func (n *Node) Start() error { func (n *Node) Start() error {
n.status = "running" n.status = "running"
if n.reg != nil {
n.reg.Start()
}
return n.startAllTask() return n.startAllTask()
} }
func (n *Node) Stop() { func (n *Node) Stop() {
close(n.quit) close(n.quit)
n.wg.Wait() n.wg.Wait()
if n.reg != nil {
n.reg.Stop()
}
n.status = "stopped" n.status = "stopped"
} }
...@@ -111,7 +118,6 @@ func (n *Node) register() { ...@@ -111,7 +118,6 @@ func (n *Node) register() {
DbIndex: n.conf.Redis.DbIndex, DbIndex: n.conf.Redis.DbIndex,
}, n) }, n)
n.reg = reg n.reg = reg
reg.Start()
} }
func (n *Node) Loop(idx int) { func (n *Node) Loop(idx int) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment