NewFuncionJob not declared by package quartz
seaung opened this issue · 5 comments
seaung commented
I have a problem
my editor prompts me that I do not have this method
an error occurred when I tried to run the code
# command-line-arguments
./main.go:16:33: not enough arguments in call to sched.ScheduleJob
have (*quartz.FunctionJob[int], *quartz.SimpleTrigger)
want (context.Context, quartz.Job, quartz.Trigger)
the code
package main
import (
"context"
"time"
"github.com/reugn/go-quartz/quartz"
)
func main() {
ctx := context.Background()
sched := quartz.NewStdScheduler()
sched.Start(ctx)
functionJob := quartz.NewFunctionJob(func(_ context.Context) (int, error) { return 42, nil })
sched.ScheduleJob(functionJob, quartz.NewSimpleTrigger(time.Second*5))
sched.Stop()
sched.Wait(ctx)
}
OS: arch linux
go version: 1.19
seaung commented
is the latest version
module gexample/quartz
go 1.19
require github.com/reugn/go-quartz v0.6.0 // indirect
reugn commented
Could you share a link to a demo project?
seaung commented
demo project source code link:
https://github.com/FDTeams/demo
reugn commented
In version 0.10.0, job implementations were moved to the job package.