disconf-基于xml分布式配置管理cronjob
2016-01-26 16:38
429 查看
本文介绍disconf如何管理cronjob的配置
spring的cronjob有2种实现方式:存入哦你job和scheduler
新建cronjob.properties,内容为:
新建cronjob.xml,内容为:
这个比较简单
参考:https://github.com/knightliao/disconf/wiki
spring的cronjob有2种实现方式:存入哦你job和scheduler
新建cronjob.properties,内容为:
# cron job task.pool.size=20 task.getMoney.delay=1000 task.getCar.cronExpression=*/1 * * * * ?
新建cronjob.xml,内容为:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 定时get car --> <bean id="getCar" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="cronJobService" /> <property name="targetMethod" value="getCar" /> </bean> <bean id="getCarJob" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="getCar" /> <property name="cronExpression" value="${task.getCar.cronExpression}"> </property> </bean> <!-- task启动列表 --> <bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="getCarJob" /> </list> </property> </bean> <!--处理任务 --> <bean id="scheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler"> <property name="poolSize" value="${task.pool.size}" /> <property name="waitForTasksToCompleteOnShutdown" value="true" /> </bean> <task:scheduled-tasks scheduler="scheduler"> <task:scheduled ref="cronJobService" method="getMoney" fixed-delay="${task.getMoney.delay}" /> </task:scheduled-tasks> </beans>
这个比较简单
参考:https://github.com/knightliao/disconf/wiki
相关文章推荐
- adb查看应用包名
- 莫比乌斯反演定理证明(两种形式)
- 扣丁学堂——MediaRecorder(录音功能)
- 使用ADIL访问远程服务
- mybatis 3
- int方法
- PyCharm远程调试设置
- oracle11g手工建库
- http://androidsource.top/code/source
- 滴滴快车奖励政策,高峰奖励,翻倍奖励,按成交率,指派单数分级(1月26日)
- disconf-基于xml分布式配置管理hbase
- 5-25 念数字
- axisfault,faultcode:server.userException异常的解决办法
- 创想
- zabbix管理七之监控nginx性能
- myusql 性能优化2
- LINUX 当中 who am i 和 whoami 的区别
- Base64加解密方法
- apache配置远程代理及缓存
- kafka manager安装