文章审核:按照固定的频率拉取任务,每秒钟拉取一次,再审核文章。
@Autowired private WmNewsAutoScanService wmNewsAutoScanService; /** * 消费任务【拉取任务】 */ @Scheduled(fixedRate = 1000) @Override public void scanNewsByTask() { log.info("消费任务,审核文章"); ResponseResult responseResult = scheduleClient.poll(TaskTypeEnum.NEWS_SCAN_TIME.getTaskType(), TaskTypeEnum.NEWS_SCAN_TIME.getPriority()); if(responseResult.getCode().equals(200) && responseResult.getData() != null){ String s = JSON.toJSONString(responseResult.getData()); Task task = JSON.parseObject(s, Task.class); WmNews wmNews = ProtostuffUtil.deserialize(task.getParameters(), WmNews.class); wmNewsAutoScanService.autoScanWmNews(wmNews.getId()); } }
再自媒体微服务启动类上开启调度任务
@EnableScheduling //开启调度任务
标签:wmNewsAutoScanService,responseResult,拉取,任务,文章,审核 From: https://www.cnblogs.com/fxzm/p/17529627.html