package a_agent

import (
	"time"
	"wdd.io/agent-common/logger"
	"wdd.io/agent-go/rabbitmq"
)

var log = logger.Log

func Activate() {
	log.Info("Module [ AGENT ] activated !")

	for {
		if octopusMessage, ok := <-rabbitmq.BusinessRuntimeQueue.ReceiveChan.AgentRChan; ok {
			// 处理数

			// 输出日志
			log.InfoF("接收到查询Agent状态的请求，结果为 => %s", octopusMessage)
		} else {
			// channel已关闭，跳出循环
			log.ErrorF("business queue [ AGENT ] receive chan has closed !")
			break
		}
		time.Sleep(time.Second * 20)
	}
}
