作业配置

Spring容器配合使用作业,可以将作业Bean配置为Spring Bean,可在作业中通过依赖注入使用Spring容器管理的数据源等对象。可用placeholder占位符从属性文件中取值。

Spring命名空间配置

<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright - Alibaba Group.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:job="http://www.dangdang.com/schema/ddframe/job"
xsi:schemaLocation="http://www.dangdang.com/schema/ddframe/job http://www.dangdang.com/schema/ddframe/job/job.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd"> <job:simple id="virtualInstanceChargeJobTrigger" job-ref="virtualInstanceChargeJob" registry-center-ref="zookeeperRegistryCenter" cron="*/30 * * * * ?" sharding-total-count="" />
</beans>

job:simple命名空间属性详细说明

属性名 类型 是否必填 缺省值 描述
id String   作业名称
class String   作业实现类,需实现ElasticJob接口,脚本型作业不需要配置
registry-center-ref String   注册中心Bean的引用,需引用reg:zookeeper的声明
cron String   cron表达式,用于配置作业触发时间
sharding-total-count int   作业分片总数
sharding-item-parameters String   分片序列号和参数用等号分隔,多个键值对用逗号分隔
分片序列号从0开始,不可大于或等于作业分片总数
如:
0=a,1=b,2=c
job-parameter String   作业自定义参数
可以配置多个相同的作业,但是用不同的参数作为不同的调度实例
monitor-execution boolean true 监控作业运行时状态
每次作业执行时间和间隔时间均非常短的情况,建议不监控作业运行时状态以提升效率。因为是瞬时状态,所以无必要监控。请用户自行增加数据堆积监控。并且不能保证数据重复选取,应在作业中实现幂等性。
每次作业执行时间和间隔时间均较长的情况,建议监控作业运行时状态,可保证数据不会重复选取。
monitor-port int -1 作业监控端口
建议配置作业监控端口, 方便开发者dump作业信息。
使用方法: echo “dump” | nc 127.0.0.1 9888
max-time-diff-seconds int -1 最大允许的本机与注册中心的时间误差秒数
如果时间误差超过配置秒数则作业启动时将抛异常
配置为-1表示不校验时间误差
failover boolean false 是否开启失效转移
monitorExecution开启,失效转移才有效
misfire boolean true 是否开启错过任务重新执行
job-sharding-strategy-class String true 作业分片策略实现类全路径
默认使用平均分配策略
详情参见:作业分片策略
description String   作业描述信息
disabled boolean false 作业是否禁止启动
可用于部署作业时,先禁止启动,部署结束后统一启动
overwrite boolean false 本地配置是否可覆盖注册中心配置
如果可覆盖,每次启动作业都以本地配置为准

Elastic-Job 配置介绍的更多相关文章

  1. 什么是blob,mysql blob大小配置介绍

    什么是blob,mysql blob大小配置介绍 作者: 字体:[增加 减小] 类型:转载   BLOB (binary large object),二进制大对象,是一个可以存储二进制文件的容器.在计 ...

  2. ecshop 工作流程加载配置介绍

    ecshop 工作流程加载配置介绍 分类: ecshop2014-09-14 09:36 729人阅读 评论(2) 收藏 举报 模板引擎工作流 这里简单介绍下echsop工作流程: 首先,你会发现一般 ...

  3. Window VNC远程控制LINUX:VNC详细配置介绍

    Window VNC远程控制LINUX:VNC详细配置介绍 //---------------------------------------vnc linux下的详细配置 1.VNC的启动/停止/重 ...

  4. ASP.NET Core 运行原理解剖[2]:Hosting补充之配置介绍

    在上一章中,我们介绍了 ASP.NET Core 的启动过程,主要是对 WebHost 源码的探索.而本文则是对上文的一个补充,更加偏向于实战,详细的介绍一下我们在实际开发中需要对 Hosting 做 ...

  5. Elastic Stack-Elasticsearch使用介绍(五)

    一.前言     前4篇将Elasticsearch用法的API和原理方面东西介绍了一下,相信大家对Elasticsearch有了一定的认知,接下我们主要从索引的建立到后期的一些优化做一些介绍: 二. ...

  6. prometheus 配置介绍

    prometheus 配置介绍 prometheus 配置分global.alerting.rule_files.scrape_configs 1.global(全局配置) scrape_interv ...

  7. Centos 7 磁盘阵列配置介绍(RAID)

    转自:https://blog.51cto.com/gaowenlong/2086918 Centos 7 磁盘阵列配置介绍每当我们提到磁盘阵列,相信广大管理员并不陌生,比如我们一般安装服务器系统的时 ...

  8. LINUX服务器搭建和常用配置介绍

    服务器搭建 : 搭建私有CA服务器 : http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_011_ca.html搭建samba服务器 : h ...

  9. Nginx 日志格式配置介绍

    Nginx日志格式配置介绍   by:授客  QQ:1033553122   测试环境 CentOS 6.5-x86_64 nginx-1.10.0 配置例子 log_format  main  '$ ...

  10. Tsung MQTT协议简介及MQTT xml文档配置介绍

    MQTT协议简介及MQTT xml文档配置介绍 by:授客 QQ:1033553122 1. MQTT协议介绍 MQTT(Message Queuing Telemetry Transport,消息队 ...

随机推荐

  1. nagios的安装与部署

    参考文献: https://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html https://www.jianshu.com/p/3476d ...

  2. ASCII编码查看

    实例说明 ASCII是American Standard Code Information Interchange的缩写,是基于拉丁字母的一套电脑编码系统,主要用于显示英文字符,是目前世界上最通用的单 ...

  3. html页面转成jsp页面之后样式变化的问题解决方法

    转载:https://blog.csdn.net/zeb_perfect/article/details/51172859

  4. Jquery常用的方法总结

    1.关于页面元素的引用通过jquery的$()引用元素包括通过id.class.元素名以及元素的层级关系及dom或者xpath条件等方法,且返回的对象为jquery对象(集合对象),不能直接调用dom ...

  5. java_基础_异常

    之前只是了解的最基础的异常形式,没有过多的深入 今天因为一些原因了解了一下 下面来说说异常的几种形式 1.try-catch语句块 代码示例 class test{ public static voi ...

  6. -ms、-moz、-webkit -o

    -ms-transform:rotate(7deg); //-ms代表ie内核 识别码-moz-transform:rotate(7deg); //-moz代表火狐内核识别码 -webkit-tran ...

  7. c++ 第一次实验

    实验内容: 2-28:实现一个简单的菜单程序,运行时显示“Menu:A(dd) D(elete) S(ort) Q(uit),Selete one:”提示用户输入.A表示增加,D表示删除, S表示排序 ...

  8. sourceTree如何不用注册就使用

    下载好之后会有这么一个界面要求你注册或登录.(不管它)将下面的一串串放进我的电脑的地址栏,打开sourcetree的文件夹 %LocalAppData%\Atlassian\SourceTree\ 注 ...

  9. python pip出错问题解决记录

    今天安装一下requests模块,遇到网络问题 pip install requests Retrying (Retry(total=4, connect=None, read=None, redir ...

  10. angular脚手架搭建

    下面以angular2.0为例前提已安装好node.js 1.安装cli执行如下命令npm install -g @angular/cli 2.创建新项目ng new my-app 3.然后到该项目目 ...