Documentation ¶
Index ¶
Constants ¶
const ( DefaultTaskTimeout = 5 * time.Second // The default task timeout. DefaultTaskRetention = 5 * time.Minute // The default task retention. MessageQueueDefaultPriority = "default" // The default queue name. MessageQueueLowPriority = "low" // The low priority queue name. MessageQueueHighPriority = "high" // The high priority queue name. TaskTypeSystemHealthCheck TaskType = iota + 1 // Health check task type. TaskTypeSystemLicenseExpiry // License expiry task type. )
Variables ¶
Functions ¶
func NewSystemHealthCheckTask ¶
NewSystemHealthCheckTask creates a new health check task.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is sending async task to the worker for processing.
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient creates a new client to send async tasks to Worker.
func (*Client) Enqueue ¶
func (c *Client) Enqueue(ctx context.Context, task *asynq.Task, opts ...asynq.Option) (*asynq.TaskInfo, error)
Enqueue sends a task to the worker for processing.
func (*Client) GetTaskInfo ¶
GetTaskInfo returns the task info for the given task ID in a queue.
type ClientOption ¶
ClientOption is a function that can be used to configure an async worker.
func WithClientConfig ¶
func WithClientConfig(conf *config.WorkerConfig) ClientOption
WithClientConfig sets the config for the worker.
func WithClientLogger ¶
func WithClientLogger(logger log.Logger) ClientOption
WithClientLogger sets the logger for the worker.
func WithClientTracer ¶
func WithClientTracer(tracer tracing.Tracer) ClientOption
WithClientTracer sets the tracer for the worker.
type HealthCheckTaskPayload ¶
type HealthCheckTaskPayload struct {
Message string `json:"message"`
}
HealthCheckTaskPayload is the payload for the health check task.
type LicenseExpiryTaskPayload ¶
type LicenseExpiryTaskPayload struct { LicenseID string LicenseEmail string LicenseOrganization string LicenseExpiresAt time.Time }
LicenseExpiryTaskPayload is the payload for the license expiry check task.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler is a task scheduler that schedules tasks to be processed at a later time.
func NewScheduler ¶
func NewScheduler(opts ...SchedulerOption) (*Scheduler, error)
NewScheduler returns a new task scheduler.
type SchedulerOption ¶
SchedulerOption is a function that can be used to configure an async scheduler.
func WithSchedulerConfig ¶
func WithSchedulerConfig(conf *config.WorkerConfig) SchedulerOption
WithSchedulerConfig sets the config for the scheduler.
func WithSchedulerLogger ¶
func WithSchedulerLogger(logger log.Logger) SchedulerOption
WithSchedulerLogger sets the logger for the scheduler.
func WithSchedulerTask ¶
func WithSchedulerTask(schedule string, task *asynq.Task) SchedulerOption
WithSchedulerTask registers a task to be scheduled at a later time.
func WithSchedulerTracer ¶
func WithSchedulerTracer(tracer tracing.Tracer) SchedulerOption
WithSchedulerTracer sets the tracer for the scheduler.