代码拉取完成,页面将自动刷新
同步操作将从 狂奔的蜗牛./wmq-go 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package main
import (
"time"
logger "github.com/snail007/mini-logger"
"fmt"
"os"
)
const (
poolInitialCap = 5
poolMaxCap = 300
poolChannelInitialCap = 10
poolChannelMaxCap = 1000
)
var (
uri = ""
mqHeartbeat = time.Second * 2
mqConnectionAndDeadlineTimeout = time.Second * 4
mqConnectionFailRetrySleep = time.Second * 3
messageDataFilePath = ""
messages = []message{}
)
func panicHandler(output string) {
fmt.Println("called" + output)
}
func main() {
ctx := log.With(logger.Fields{"func": "main"})
ctx.Info("WMQ Service Started")
initConsumerManager()
if err := initMessages(); err != nil {
ctx.With(logger.Fields{"call": "initMessages()"}).Fatalln("%s", err)
}
if !cfg.GetBool("api-disable") {
//init api service
go serveAPI(cfg.GetString("listen.api"), cfg.GetString("api.token"))
}
//init publish service
go servePublish(cfg.GetString("listen.publish"))
select {}
}
func init() {
fmt.Println(poster())
var err error
err = initConfig()
if err != nil {
fmt.Printf("%s", err)
os.Exit(0)
}
initLog()
ctx := log.With(logger.Fields{"func": "init"})
vhost := cfg.GetString("rabbitmq.vhost")
if vhost != "/" {
vhost = "/" + vhost
}
uri = fmt.Sprintf("amqp://%s:%s@%s:%d%s",
cfg.GetString("rabbitmq.username"),
cfg.GetString("rabbitmq.password"),
cfg.GetString("rabbitmq.host"),
cfg.GetInt("rabbitmq.port"),
vhost)
messageDataFilePath = cfg.GetString("consume.DataFile")
messages, err = loadMessagesFromFile(messageDataFilePath)
if err != nil {
ctx.Safe().Fatalf("load message data form file fail [%s],%s", messageDataFilePath, err)
}
if err = initPool(); err != nil {
ctx.Safe().Fatalf("init connection to rabbitmq fail : %s", err)
}
if err = initChannelPool(); err != nil {
ctx.Safe().Fatalf("init Channel Pool fail : %s", err)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。