spring4 quartz2 集群动态任务
实现定时任务的执行,而且要求定时周期是不固定的。测试地址:http://sms.reyo.cn
生产环境:nginx+tomcat+quartz2.2.1+spring4.2.1 集群。
实现功能:可添加新任务,删除任务,更新任务,暂停任务,恢复任务
任务管理:


修改任务:

新增任务:


静态任务实现每20秒websocket向客户端发送一文字消息和图片信息。
静态任务测试地址(刷新地址可以看到访问到不同的服务器):http://sms.reyo.cn/socket.html
以下是静态任务配置文件:
<?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:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"> <!-- 启动触发器的配置开始 -->
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="autoBatchTestTrigger" />
<!-- <ref bean="cleanErrorTaskTrigger"/> -->
</list>
</property>
<property name="schedulerName"><value>first</value></property>
</bean>
<!-- 启动触发器的配置结束 --> <!-- 自动测试任务的配置 -->
<bean id="autoBatchTestTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="autoBatchTestJobDetail" />
</property>
<property name="cronExpression">
<value>*/20 * * * * ?</value>
</property> </bean>
<!-- 调度的配置结束 --> <!-- job的配置开始 -->
<bean id="autoBatchTestJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="autoBatchTestJob" />
</property>
<property name="targetMethod">
<value>autoBatchTestTask</value>
</property>
</bean>
<!-- job的配置结束 --> <!-- 工作的bean -->
<bean id="autoBatchTestJob" class="reyo.sdk.websocket.quartz.QuartzTaskManager" />
<!-- 自动测试任务结束 --> </beans>
spring4 quartz2 集群动态任务的更多相关文章
- Spring4+quartz2集群借助邮箱或是短信实现生日的农历提醒(Quartz实现农历、阴历、公历生日提醒)
自己记性差,除了老婆.老大和自己的生日以外,一直记不住亲朋好友的生日,长辈们的生日基本上又都是用农历来算,公历的话,直接用Quartz设置循环提醒,农历就没辙了,每每搞的自己很尴尬,需要别人来提醒自己 ...
- Hadoop概念学习系列之Hadoop集群动态增加新节点或删除已有某节点及复制策略导向 (四十三)
不多说,直接上干货! hadoop-2.6.0动态添加新节点 https://blog.csdn.net/baidu_25820069/article/details/52225216 Hadoop集 ...
- adoop集群动态添加和删除节点
hadoop集群动态添加和删除节点说明 上篇博客我已经安装了Hadoop集群(hadoop集群的安装步骤和配置),现在写这个博客我将在之前的基础上进行节点的添加的删除. 首先将启动四台机器(一主三从) ...
- Redis进阶实践之十二 Redis的Cluster集群动态扩容
一.引言 上一篇文章我们一步一步的教大家搭建了Redis的Cluster集群环境,形成了3个主节点和3个从节点的Cluster的环境.当然,大家可以使用 Cluster info 命令查看Cl ...
- Redis搭建(七):Redis的Cluster集群动态增删节点
一.引言 上一篇文章我们一步一步的教大家搭建了Redis的Cluster集群环境,形成了3个主节点和3个从节点的Cluster的环境.当然,大家可以使用 Cluster info 命令查看Cluste ...
- kubernetes实战(九):k8s集群动态存储管理GlusterFS及使用Heketi扩容GlusterFS集群
1.准备工作 所有节点安装GFS客户端 yum install glusterfs glusterfs-fuse -y 如果不是所有节点要部署GFS管理服务,就在需要部署的节点上打上标签 [root@ ...
- keepalive + nginx 搭建高可用集群动态网站
环境准备: 两台节点部署keepalived,并且设为互为主从,实现高可用. 两台从节点部署nginx以及相关组件,作为真实服务器实现动态网站上线. 一.MASTER(BACKUP)节点下载keepa ...
- Hadoop集群动态服役新的数据节点&&退役数据节点
备注:新添的机器为hadoop05,现有hadoop01.hadoop02.hadoop03.hadoop04 环境准备: 1.先克隆一台和集群中一样的机器 2.修改机器ip和主机名称 3.删除原来的 ...
- Spring Cloud Eureka集群 动态扩展新节点
场景描述: Eureka的集群节点有两个,互相注册形成集群,已经支持动态刷新(不知道怎么让Eureka支持动态刷新的可以参考http://www.cnblogs.com/flying607/p/845 ...
随机推荐
- wpf XAML 设计器异常,提示NullReferenceException 未将对象引用设置到对象例
设计了一个控件,然后在使用该控件的界面上,出现上图,这个应该是设计器的bug,解决办法 不要在界面上直接写Load事件 在cs构造函数里手动注册,并且在控件的构造函数里增加判断 if (Designe ...
- KnockoutJs学习笔记(八)
with binding用于创建一个新的绑定环境(binding context),包含with binding的元素的所有子元素都将处于指定的object的环境限定内. 下面是一个简单的使用with ...
- 【AtCoder】ARC100 题解
C - Linear Approximation 找出\(A_i - i\)的中位数作为\(b\)即可 题解 #include <iostream> #include <cstrin ...
- POJ 3017 Cut the Sequence
[题目链接] $O(n^2)$ 效率的 dp 递推式:${ dp }_{ i }=min\left( dp_{ j }+\overset { i }{ \underset { x=j+1 }{ max ...
- 001.SMB简介
一 简介 samba基于NetBIOS协议开发,能和windows通信,但只能在局域网通信. 二 Samba主要应用 文件共享 打印服务器 Samba登录时身份验证 进行windows主机名解析 三 ...
- 那些年我们踩过的坑之表单reset
开发者往往是在一个又一个的坑中成长起来的,自学的开发者尤其如此,刚刚填完一个坑,转身又掉进另一个坑.有些坑很容易就跳出来了,也有些坑能整了一天都没头绪,第二天早上一来发现后面就有一架通往坑外的梯子,坑 ...
- 蓝牙设备探测工具blueranger
蓝牙设备探测工具blueranger blueranger是Kali Linux预安装的一款蓝牙探测工具.该工具通过向指定设备发送蓝牙L2CAP协议的ping包,创建连接.由于大部分蓝牙设备对pi ...
- JS脚本获取开发者后台所有Device
``` var ids = ["Device ID"]; var names = ["Device Name"]; $("td[aria-descri ...
- Redis五大类型操作使用以及订阅发布功能
redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(sorted set ...
- 【μ'sic forever♪♪♪】μ's Final Love Live周年纪念
一.正文 “切なくて时をまきもどしてみるかい?No no no……いまが最高!” 转眼就是一周年了,其实fl后入坑的我在这里怀念显得有些无病呻吟.但我也有想说的话,说给重要的人听. “ほのかな予感から ...