[agent][executor]- 优化command executor的代码

This commit is contained in:
zeaslity
2023-02-25 17:02:21 +08:00
parent 8187fe7baa
commit 511cfd97f6
2 changed files with 6 additions and 3 deletions

View File

@@ -71,15 +71,18 @@ public class OctopusAgentInitService {
)
public void ReceiveInitInfoFromServer(Message message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
OctopusMessage octopusMessage;
try {
OctopusMessage octopusMessage = objectMapper.readValue(message.getBody(), OctopusMessage.class);
octopusMessage = objectMapper.readValue(message.getBody(), OctopusMessage.class);
// consider the multi-agents register situation
// judge the machineID begin
String[] split = octopusMessage.getUuid().split("-");
if (!agentServerInfo.getMachineId().startsWith(split[split.length - 1])) {
throw new MyRuntimeException("INIT Message not for this agent !");
String s = "INIT Message not for this agent !";
log.error(s);
throw new MyRuntimeException(s);
}
// response chain to handle all kind of type of octopus message