hpds_node/example/multi-mq/mq2/main.go

35 lines
636 B
Go

package main
import (
"git.hpds.cc/Component/network/log"
"git.hpds.cc/pavement/hpds_node"
"os"
)
func main() {
mq := hpds_node.NewMqWithOptions(
"mq-2",
hpds_node.WithMqAddr("localhost:27188"),
hpds_node.WithAuth("token", "06d36c6f5705507dae778fdce90d0767"),
)
defer func(mq hpds_node.MessageQueue) {
_ = mq.Close()
}(mq)
err := mq.ConfigWorkflow("mq_2.yaml")
if err != nil {
log.Errorf("Server load workflow error! %s", err)
return
}
// start mq service
log.Printf("Server has started!, pid: %d", os.Getpid())
go func() {
err := mq.ListenAndServe()
if err != nil {
panic(err)
}
}()
select {}
}