How to add new schedule job dynamically with Spring

后端 未结 3 537
别跟我提以往
别跟我提以往 2020-12-13 05:49

I am writing a Spring Boot App

My requirements are - In the resources (src/main/resources) folder if I add new xml files.. I should read those files and get some ur

3条回答
  •  旧时难觅i
    2020-12-13 06:10

    Try this library with external dynamic parameters configuration, real time monitoring:

    https://github.com/tyrion9/mtask

    Config params in mtasks.yml

    -   code: complex
        scheduled:
            period: 1000
        name: Autowired Param MTask
        className: sample.sample2.ComplexMTask
        params:
            name: HoaiPN
        autoStart: true
    

    Dynamic params configurations on the fly:

    curl -X GET http://localhost:8080/api
    
    curl -X POST http://localhost:8080/api/helloworld/stop
    
    curl -X POST http://localhost:8080/api/helloworld/start
    

提交回复
热议问题