sunkai-cai opened a new pull request #1954:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1954


   Fixes #1445 
   
   anothor  annotation define design to discuss.  
   
   1. define annotation `EnableElasticJob` , like this:
   
   ```
   @ElasticScheduled(
           cron = "0/5 * * * * ?",
           jobName = "SimpleTestJobFirst",
           shardingTotalCount = 3,
           shardingItemParameters = "0=Beijing,1=Shanghai,2=Guangzhou",
           jobListenerTypes = {"NOOP", "LOG"},
           props = {
                   @ElasticJobProp(key = "print.title", value = "test title"),
                   @ElasticJobProp(key = "print.content", value = "test 
content")
           }
   )
   @ElasticScheduled(
           cron = "0/5 * * * * ?",
           jobName = "SimpleTestJobSecond",
           shardingTotalCount = 3,
           shardingItemParameters = "0=Beijing,1=Shanghai,2=Guangzhou",
           jobListenerTypes = {"NOOP", "LOG"},
           props = {
                   @ElasticJobProp(key = "print.title", value = "test title"),
                   @ElasticJobProp(key = "print.content", value = "test 
content")
           }
   )
   public class SimpleTestJob implements CustomJob {
       
       @Override
       public void execute(final ShardingContext shardingContext) {
       }
       
   }
   ```
   
   2. define annotation `ElasticScheduled` , like this:
   
   ```
   @Configuration
   @ElasticScheduled(scanBasePackages = 
"org.apache.shardingsphere.elasticjob.lite.example.job.simple")
   public class ElasticConfig {
      @Bean
      public CoordinatorRegistryCenter registryCenter() {
        return new ZookeeperRegistryCenter(new ZookeeperConfiguration());
      }
   }
   ```
   
   
   Changes proposed in this pull request:
   - add annotation `ElasticScheduled`, `ElasticScheduled` define
   - add annotation `ElasticScheduled` define
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to