Search in sources :

Example 1 with DemoJobHandler

use of com.xuxueli.executor.sample.jfinal.jobhandler.DemoJobHandler in project xxl-job by xuxueli.

the class JFinalCoreConfig method initXxlJobExecutor.

private void initXxlJobExecutor() {
    // registry jobhandler
    XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
    XxlJobExecutor.registJobHandler("shardingJobHandler", new ShardingJobHandler());
    // load executor prop
    Prop xxlJobProp = PropKit.use("xxl-job-executor.properties");
    // init executor
    xxlJobExecutor = new XxlJobExecutor();
    xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses"));
    xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname"));
    xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip"));
    xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port"));
    xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken"));
    xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath"));
    xxlJobExecutor.setLogRetentionDays(xxlJobProp.getInt("xxl.job.executor.logretentiondays"));
    // start executor
    try {
        xxlJobExecutor.start();
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : ShardingJobHandler(com.xuxueli.executor.sample.jfinal.jobhandler.ShardingJobHandler) XxlJobExecutor(com.xxl.job.core.executor.XxlJobExecutor) DemoJobHandler(com.xuxueli.executor.sample.jfinal.jobhandler.DemoJobHandler) Prop(com.jfinal.kit.Prop)

Aggregations

Prop (com.jfinal.kit.Prop)1 DemoJobHandler (com.xuxueli.executor.sample.jfinal.jobhandler.DemoJobHandler)1 ShardingJobHandler (com.xuxueli.executor.sample.jfinal.jobhandler.ShardingJobHandler)1 XxlJobExecutor (com.xxl.job.core.executor.XxlJobExecutor)1