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