ElasticJob provides a Java API, which can control the life cycle of jobs in a distributed environment by directly operating the registry.
The module is still in incubation. Possible dependency configurations are as follows,
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-lifecycle</artifactId>
<version>${elasticjob.version}</version>
</dependency>
Class name: org.apache.shardingsphere.elasticjob.lifecycle.api.JobConfigurationAPI
Method signature:JobConfigurationPOJO getJobConfiguration(String jobName)
Parameters:
Returns: Job configuration object
Method signature:void updateJobConfiguration(JobConfigurationPOJO jobConfig)
Method signature:void removeJobConfiguration(String jobName)
Class name:org.apache.shardingsphere.elasticjob.lifecycle.api.JobOperateAPI
The job will only trigger execution if it does not conflict with the currently running job, and this flag will be automatically cleared after it is started.
Method signature:void trigger(String jobName)
Disabling a job will cause other distributed jobs to trigger resharding.
Method signature:void disable(String jobName, String serverIp)
Method signature:void enable(String jobName, String serverIp)
Method signature:void shutdown(String jobName, String serverIp)
Method signature:void remove(String jobName, String serverIp)
Method signature:String dump(String jobName, String instanceIp, int dumpPort) throws IOException
Class name:org.apache.shardingsphere.elasticjob.lifecycle.api.ShardingOperateAPI
Method signature:void disable(String jobName, String item)
Method signature:void enable(String jobName, String item)
Class name:org.apache.shardingsphere.elasticjob.lifecycle.api.JobStatisticsAPI
Method signature:int getJobsTotalCount()
Method signature:JobBriefInfo getJobBriefInfo(String jobName)
Parameters:
Returns: The brief job information
Method signature:Collection<JobBriefInfo> getAllJobsBriefInfo()
Method signature:Collection<JobBriefInfo> getJobsBriefInfo(String ip)
Parameters:
Returns: Brief collection of job information
Class name:org.apache.shardingsphere.elasticjob.lifecycle.api.ServerStatisticsAPI
Method signature:int getServersTotalCount()
Method signature:Collection<ServerBriefInfo> getAllServersBriefInfo()
Class name:org.apache.shardingsphere.elasticjob.lifecycle.api.ShardingStatisticsAPI
Method signature:Collection<ShardingInfo> getShardingInfo(String jobName)
Parameters:
Returns: The collection of job sharding information