Documentation
¶
Index ¶
- Constants
- type Config
- type CronJobExt
- func (t *CronJobExt) Application() *gobay.Application
- func (t *CronJobExt) Close() error
- func (t *CronJobExt) Init(app *gobay.Application) error
- func (t *CronJobExt) Object() interface{}
- func (t *CronJobExt) RegisterTasks(ts map[string]*CronJobTask) error
- func (t *CronJobExt) RemoveAllJobs()
- func (t *CronJobExt) StartCronJob(enableHealthCheck bool)
- type CronJobSchedulerType
- type CronJobTask
Constants ¶
View Source
const ( DurationScheduler = "duration" // time.ParseDuration style expressions CronScheduler = "crontab" // crontab style expressions )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
AsyncTaskConfig *config.Config `yaml:"-" ignored:"true"`
BindTo string `yaml:"bind_to"`
TimeZone string `yaml:"tz"`
HealthCheckPort int `yaml:"health_check_port"` // default is 5000
}
Config configuration of cronjobext
type CronJobExt ¶
type CronJobExt struct {
NS string
// TimeZone scheduler's timezone
TimeZone *time.Location
// contains filtered or unexported fields
}
func (*CronJobExt) Application ¶
func (t *CronJobExt) Application() *gobay.Application
func (*CronJobExt) Close ¶
func (t *CronJobExt) Close() error
func (*CronJobExt) Init ¶
func (t *CronJobExt) Init(app *gobay.Application) error
func (*CronJobExt) Object ¶
func (t *CronJobExt) Object() interface{}
func (*CronJobExt) RegisterTasks ¶
func (t *CronJobExt) RegisterTasks(ts map[string]*CronJobTask) error
RegisterTasks this function can only be used before the scheduler starting.
func (*CronJobExt) RemoveAllJobs ¶
func (t *CronJobExt) RemoveAllJobs()
RemoveAllJobs stops and deletes all scheduled tasks, but the scheduler itself does not stop running
func (*CronJobExt) StartCronJob ¶
func (t *CronJobExt) StartCronJob(enableHealthCheck bool)
StartCronJob this function will be blocked until the scheduler exits
type CronJobSchedulerType ¶
type CronJobSchedulerType string
type CronJobTask ¶
type CronJobTask struct {
Type CronJobSchedulerType
// Spec Scheduled interval or cron expression
Spec string
// TaskFunc the function be registered into AsyncTaskExt.
// This function must also be registered on the async task worker side.
TaskFunc interface{}
// TaskSignature the args of the TaskFunc,
// The value of tasks.Signature.Name must be the same as the Name with which the TaskFunc was registered.
TaskSignature *tasks.Signature
}
Click to show internal directories.
Click to hide internal directories.