[Excution] - base function start - 3

This commit is contained in:
IceDerce
2023-06-25 11:31:27 +08:00
parent fb38ab8f15
commit 80198930c4
3 changed files with 11 additions and 11 deletions

View File

@@ -1,7 +1,6 @@
package rabbitmq
import (
"agent-go"
"agent-go/g"
"encoding/json"
"fmt"
@@ -9,6 +8,8 @@ import (
var OctopusToServerQueue = &RabbitQueue{}
var P = g.G.P
func BuildOMsgRuntimeConnectorQueue(agentTopicName string) {
// 建立 业务消息 接收队列
@@ -51,12 +52,12 @@ func BuildOMsgRuntimeConnectorQueue(agentTopicName string) {
deliveries := octopusMsgQueue.Read(true)
forever := make(chan bool)
main.P.Submit(
P.Submit(
func() {
// 死循环处理Octopus Message
for delivery := range deliveries {
var om *main.OctopusMessage
var om *OctopusMessage
err := json.Unmarshal(delivery.Body, &om)
if err != nil {
log.Error(fmt.Sprintf("octopus message convert to json is wrong! msg is => %s", delivery.Body))
@@ -65,7 +66,7 @@ func BuildOMsgRuntimeConnectorQueue(agentTopicName string) {
}
// 策略模式 处理消息
main.P.Submit(func() {
P.Submit(func() {
om.Handle()
})
}