Distributed regular tasks Elastic-Job Support manually add a one-time task

Recently used regular tasks, business scenarios need to support distributed, although Elastic-Job had stopped more, but basically meet the demand, and the framework has been validated through multiple manufacturers, the source line and the frame also feel easy to control the amount of light Some, thus achieving the timer task based Elastic-job-lite

A few pain points
  • There is the task of manually trigger a scene (although it was later temporarily not achieved in this way, the paper if there is any place vulnerable, welcome Paizhuan), but does not support Elastic-Job
  • Want to manually trigger the task still can make use of Elastic-Job flexible mechanisms (failover and fragmentation mechanisms)
  • Manually trigger the task may be disposable, that want to trigger the implementation of related tasks in a task completed before execution, that is, dependencies between tasks
  • Hope to see real-time processing of the mandate, which is elastic-job-lite-console do, but the elastic-job-lite-console need to deploy a separate direct zookeeper, zookeeper, including network may, of course, can be deployed in the console within the network, this will increase the number of maintenance problems
What do something
  • Add a task to comment ScheduledTask, reducing development effort to develop the students only need to add annotations to configure, upgrade also supports configuration task to application.yml and other configuration files, configuration files, the highest priority
  • When the timing tasks manually increase the support (e.g., the timing task starts after 1 minute), increasing to listen through all zookeeper namespace distributed nodes, adding and deleting job namespace node running JobRegistry present jvm comparison, deciding whether to add or delete job
  • Support task is performed only once, increase runOnce parameters in the job parameter, the monitor implementation of the mandate in AbstractDistributeOnceElasticJobListener, when the task is all the slices is finished, remove the zookeeper job junction, turn the jvm job and job listener (to prevent the thread count rising )
  • Custom exceptionhandler, increase convenience for business on their own log alarms
  • The elastic-job-lite-console integrated into the project, because console comes with a weak authentication mechanism, the proposed timing of project tasks required by https to access, modify or authentication mechanism
  • Adds a task monitor alarm mechanism, if cron task specified time, the alarm does not start, I feel this relatively tasteless, can be turned off by parameter

Sample Project


历史文章:

Reproduced in: https: //juejin.im/post/5d04d4b45188254a10112650

Guess you like

Origin blog.csdn.net/weixin_34192732/article/details/93175372