34 lines
602 B
Go
34 lines
602 B
Go
package main
|
|
|
|
import (
|
|
"git.hpds.cc/Component/network/log"
|
|
"git.hpds.cc/pavement/hpds_node"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
mq, err := hpds_node.NewMq("mq_1.yaml")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
mq.InitOptions(hpds_node.WithAuth("token", "z1"))
|
|
defer mq.Close()
|
|
|
|
// add Downstream mq
|
|
mq.AddDownstreamMq(hpds_node.NewDownstreamMq(
|
|
"mq-2",
|
|
hpds_node.WithMqAddr("localhost:27187"),
|
|
hpds_node.WithCredential("token:z2"),
|
|
))
|
|
|
|
// start mq service
|
|
log.Printf("Server has started!, pid: %d", os.Getpid())
|
|
go func() {
|
|
err := mq.ListenAndServe()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}()
|
|
select {}
|
|
}
|