[ Service ] [ Executor ] 初步重构Executor部分的代码

This commit is contained in:
zeaslity
2023-08-10 17:18:08 +08:00
parent fbd8348e15
commit d2c57f8d7b
2 changed files with 3 additions and 15 deletions

View File

@@ -9,6 +9,7 @@ import (
"fmt"
"gopkg.in/yaml.v3"
"io/ioutil"
"strings"
"time"
)
@@ -126,7 +127,7 @@ func handleInitMsgFromServer(initFromServerQueue *rabbitmq.RabbitQueue, initToSe
serverName := serverInfo.ServerName
// 处理OM信息
if initOctopusMsg != nil && initOctopusMsg.Type == g.InitOmType && serverName == agentServerInfo.ServerName {
if initOctopusMsg != nil && strings.HasPrefix(initOctopusMsg.Type, g.InitOmType) && strings.HasPrefix(serverName, agentServerInfo.ServerName) {
// 是本机的注册回复信息
log.InfoF("OctopusMessage INIT from server is this agent !")
@@ -144,7 +145,7 @@ func handleInitMsgFromServer(initFromServerQueue *rabbitmq.RabbitQueue, initToSe
} else {
// 不是自身的 注册回复信息 -- 拒绝 2023年6月19日 此处存在错误! 会死循环Nack 导致异常
log.Warn(fmt.Sprintf("OctopusMessage INIT from server not this agent ! => %v, ==>%s", initOctopusMsg, delivery.Body))
log.Warn(fmt.Sprintf("OctopusMessage INIT from server not this agent ! => %v, ", initOctopusMsg))
delivery.Ack(false)
// 需要休眠等待不再获取相应的信息

View File

@@ -52,19 +52,6 @@ public class OMessageToAgentSender {
octopusMessage
);
// 统一处理Content
if (octopusMessage.getContent() instanceof String) {
try {
String contendString = OctopusObjectMapper.writeValueAsString(octopusMessage.getContent());
octopusMessage.setContent(contendString);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
rabbitTemplate.convertAndSend(
initRabbitMQConfig.INIT_EXCHANGE,
initRabbitMQConfig.INIT_FROM_SERVER_KEY,