A demo project for cdule library.
Add cdule library as the dependency
go get github.com/deepaksinghvi/cdule
or use the following for go1.18 with tag v1.0.3
go1.18beta2 get github.com/deepaksinghvi/[email protected]
cdule := cdule.Cdule{}
cdule.NewCdule()
testJob := job2.TestJob{}
jobData := make(map[string]string)
jobData["one"] = "1"
jobData["two"] = "2"
jobData["three"] = "3"
testJobModel, _ := watcher.NewJob(&testJob, jobData).Build(utils.EveryMinute)
On submission with the help of the Build() method, job will get scheduled and it will keep running it based on the cron scheduled provided.
time.Sleep(5 * time.Minute)
cdule.StopWatcher()
Worker name to be picked based on the hostname
./cduledemo
or worker name can be supplied in the format of cduledemo
cduledemo worker1
For more details check documentation.