CommonsSpiderService.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:spider 作者:
/**
 * 根据爬虫模板ID批量启动任务
 *
 * @param spiderInfoIdList 爬虫模板ID列表
 * @return 任务id列表
 */
public ResultListBundle<String> startAll(List<String> spiderInfoIdList) {
    return bundleBuilder.listBundle(spiderInfoIdList.toString(), () -> {
        List<String> taskIdList = Lists.newArrayList();
        for (String id : spiderInfoIdList) {
            try {
                SpiderInfo info = spiderInfoService.getById(id).getResult();
                String taskId = commonSpider.start(info);
                taskIdList.add(taskId);
            } catch (JMException e) {
                LOG.error("启动任务ID{}出错,{}", id, e);
            }
        }
        return taskIdList;
    });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号