|
1 月之前 | |
---|---|---|
.. | ||
internal | 1 月之前 | |
README.md | 1 年之前 | |
main.go | 1 年之前 |
监听rabbitmq中的topic为sparrow.task.timer主题的消息,执行定时任务
// TimerTaskMessage 定时任务消息
type TimerTaskMessage struct {
Cron string `json:"cron"` // 任务执行的cron表达式
Actions []*TaskAction `json:"actions"` // 执行动作列表
}
// TaskAction 定时任务执行动作
type TaskAction struct {
EntityId string `json:"entity_id"` // 被执行实体Id,指向设备编码
/*
动作对象类型。
delay:延时
device_issue:设备指令下发
device_group_issue:群组指令下发
*/
ActionExecutor string `json:"action_executor"` // 动作对象类型。
ExecutorProperty *TaskExecutorProperty `json:"executor_property"` // 动作执行明细
}
// TaskExecutorProperty 定时任务执行动作执行参数
type TaskExecutorProperty struct {
/*
指令 code。当 action_executor 是 device_issue 或 device_group_issue 时,此参数必填。
*/
FunctionCode string `json:"function_code"`
/*
指令 value。当 action_executor 是 device_issue 或 device_group_issue 时,此参数必填。
*/
FunctionValue bool `json:"function_value"`
/*
延时时间。当 action_executor 是 delay 时,此参数必填。
*/
DelaySeconds int64 `json:"delay_seconds"`
}