Documentation ¶
Overview ¶
Package hjob contains interfaces to define workers to process background jobs. --------------------------------
Index ¶
Constants ¶
View Source
const Version = "1.0.0"
Version is the package current version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CronJob ¶
type CronJob struct { Name string // required Queue string // Retry specify retry counts of the job. // 0: means that throw job away (and dont push to dead queue) on first fail. // -1: means that push job to the dead queue on first fail. Retry int }
CronJob is a new instance of cron job that should run in schedules time.
func NewCronJobWithQueue ¶
NewCronJobWithQueue returns new cron job instance
type CronJobHandlerFunc ¶
CronJobHandlerFunc is the handler of each cron job in the worker.
type CronJobs ¶
type CronJobs interface { // Register handler for new cron job Register(spec string, cJob *CronJob, handler CronJobHandlerFunc) error hexa.Runnable }
CronJobs get your cron-jobs specs
type Job ¶
type Job struct { Name string // required Queue string // Retry specify retry counts of the job. // 0: means that throw job away (and dont push to dead queue) on first fail. // -1: means that push job to the dead queue on first fail. Retry int Timeout time.Duration ProcessAt *time.Time // Process the job at specific time. Payload interface{} // It can be any struct. }
Job is a new instance of job to push to the queue by Jobs interface
func NewJobWithQueue ¶
NewJobWithQueue returns new job instance
type JobHandlerFunc ¶
JobHandlerFunc is the handler of each job in the worker.
Click to show internal directories.
Click to hide internal directories.