Giter Club home page Giter Club logo

elastic-job-spring-boot-starter's Introduction

elastic-job--spring-boot-starter

setup 1

import dependency

        <dependency>
            <groupId>com.vanke</groupId>
            <artifactId>elastic-job-spring-boot-starter</artifactId>
            <version>0.1-SNAPSHOT</version>
        </dependency>

setup 2

setting up application.yml

#elastic-job
elaticjob:
  zookeeper:
    serverList: localhost:2181
    namespace: dd-job
  event:
    datasource:
      url: jdbc:mysql://localhost:3306/job_event_db?useUnicode=true&characterEncoding=utf-8&verifyServerCertificate=false&useSSL=false&requireSSL=false
      driver-class-name: com.mysql.jdbc.Driver
      username: root
      password: root

setup 3

define job class

import com.dangdang.elasticjob.annotation.ElasticSimpleJob;
import com.dangdang.ddframe.job.api.ShardingContext;


@Component
public class MyJob {

    //Job configuration annotation
    @ElasticSimpleJob("0 * * * * ?")
    public void tastExample1(ShardingContext shardingContext) {
        //do something
    }
}

Notation

1、该注解目前只在方法级别,类级别待扩展 2、若不声明分片数,默认分片数为1 3、event存储支持数据源配置

   a、配置文件中通过elaticjob.evet.datasource声明
   b、注解ElasticSimpleJob中dataSource属性指定,其value必须是已注入spring中的bean
   后者会覆盖前者,若都不指定,event不会存储,console事件追踪页面会为空
   */

elastic-job-spring-boot-starter's People

Contributors

tutar avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.