[agent-go] 优化代码,完成连通性测试
This commit is contained in:
@@ -28,26 +28,6 @@ func BuildOMsgRuntimeConnectorQueue(agentTopicName string) {
|
||||
}
|
||||
octopusMsgQueue.Connect()
|
||||
|
||||
deliveries := octopusMsgQueue.Read(true)
|
||||
|
||||
// 死循环,处理Octopus Message
|
||||
P.Submit(
|
||||
func() {
|
||||
for delivery := range deliveries {
|
||||
|
||||
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))
|
||||
// 保存到某处
|
||||
continue
|
||||
}
|
||||
|
||||
// 策略模式 处理消息
|
||||
om.Handle()
|
||||
}
|
||||
})
|
||||
|
||||
// 建立 业务消息 返回队列
|
||||
// 统一为 OctopusToServer
|
||||
|
||||
@@ -67,6 +47,29 @@ func BuildOMsgRuntimeConnectorQueue(agentTopicName string) {
|
||||
// 开启运行时消息返回队列
|
||||
OctopusToServerQueue.Connect()
|
||||
|
||||
log.InfoF("Octopus Message Replay Queue is established ! => %v", OctopusToServerQueue)
|
||||
log.InfoF("Octopus Message Business Runtime Queue is established ! => %v", OctopusToServerQueue)
|
||||
|
||||
deliveries := octopusMsgQueue.Read(true)
|
||||
forever := make(chan bool)
|
||||
P.Submit(
|
||||
func() {
|
||||
// 死循环,处理Octopus Message
|
||||
for delivery := range deliveries {
|
||||
|
||||
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))
|
||||
// 保存到某处
|
||||
continue
|
||||
}
|
||||
|
||||
// 策略模式 处理消息
|
||||
om.Handle()
|
||||
}
|
||||
})
|
||||
|
||||
// wait forever
|
||||
<-forever
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user