package com.care.mqtt.schedule; import com.care.mqtt.service.MqttMsgRedisService; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; /** 手动外呼话单调度 * @author 许明 * @version 2.7.0.0 创建于 2018/7/16 **/ @Configuration @EnableScheduling public class MqttMsgSchedule { private static final Logger logger = LogManager.getLogger(MqttMsgSchedule.class); @Autowired private MqttMsgRedisService mqttMsgRedisService; /** * 10 秒钟调用一次 */ @Scheduled(cron = "0/10 * * * * ?") public void rotationRedis() { try { mqttMsgRedisService.rotationRedis(); } catch (Exception e) { logger.error("轮训redis出错:{}", e.getMessage()); } } }