Project address: https://github.com/robert-guangzhou/elasticjob-autodeploy-example
This project demonstrates how to develop your own job and deploy it using elasticjob-autodeploy.
Focus
There is no difference between job development and native elasticjob.
Use autodeploy to replace native elasticjob in the dependent jar in pom.xml.
elasticjob-autodeploy example description
There are 2 job classes under package com.radishgz.elasticjobautodeploy.example.
One of them is the spring bean model, and the other is the non-bean model.
Take mysql database as an example, insert data
INSERT INTO `job_settings` (`job_name`, `job_type`, `job_class`, `cron`, `sharding_total_count`, `sharding_item_parameters`, `job_parameter`, `monitor_execution`, `streaming_process`, `max_time_diff_seconds`, `monitor_port`, `failover`, `misfire`, `job_sharding_strategy_class`, `description`, `script_command_line`, `reconcile_interval_minutes`, `job_group`, `status`, `status_date`) VALUES
('SimpleJob-exmaple', 'SIMPLE', 'com.radishgz.elasticjobautodeploy.example.JavaSimpleJob', '0/5 * * * * ?', 1, '', '', 1, 0, 10, -1, 0, 1, '', 'description', NULL, 10, 'default', 'ENABLED', NULL),
('SpringBeanSimpleJob-example', 'SIMPLE', 'com.radishgz.elasticjobautodeploy.example.SpringBeanSimpleJob', '0/5 * * * * ?', 1, '', '', 1, 0, 10, -1, 0, 1, '', 'description', NULL, 10, 'default', 'ENABLED', NULL);
Followed by
1. Run ElasticjobAutodeployApplicationTests in Junit mode
2. Or run directly in application mode
You can find that both jobs are running automatically.
Actual production deployment
It should be noted that if spring beans are used, the relevant packae need to be added to ComponentScan.basePackages in application.properties.
The entire project can be deployed in springboot uber jar mode.