Documentation ¶
Index ¶
- Variables
- type Job
- func (j *Job) Cancel(ctx context.Context) error
- func (j *Job) Config() dispatch.Config
- func (j *Job) Context() context.Context
- func (j *Job) DispatchedAt() time.Time
- func (j *Job) Done() <-chan struct{}
- func (j *Job) Err() error
- func (j *Job) Mail() postdog.Mail
- func (j *Job) Runtime() time.Duration
- type Mailer
- type Option
- type Queue
- func (q *Queue) Dispatch(ctx context.Context, m postdog.Mail, opts ...dispatch.Option) (*Job, error)
- func (q *Queue) DispatchConfig(ctx context.Context, m postdog.Mail, cfg dispatch.Config) (*Job, error)
- func (q *Queue) Start() error
- func (q *Queue) Started() bool
- func (q *Queue) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrStarted means the queue has already been started. ErrStarted = errors.New("queue already started") // ErrNotStarted means the queue has not been started yet. ErrNotStarted = errors.New("queue not started") // ErrCanceled means a job has been canceled by either calling job.Cancel() or by canceling it's context. ErrCanceled = errors.New("job canceled") // ErrFinished means a job has already been finished and can therefore not be canceled. ErrFinished = errors.New("job already finished") )
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job is a queue job.
func (*Job) Context ¶
Context returns the job's context that has been passed to the (*Queue).Dispatch() method.
func (*Job) DispatchedAt ¶
DispatchedAt returns the time at which j was dispatched.
type Option ¶
type Option func(*Queue)
Option is a queue option.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is the mailer queue.
func (*Queue) Dispatch ¶
func (q *Queue) Dispatch(ctx context.Context, m postdog.Mail, opts ...dispatch.Option) (*Job, error)
Dispatch adds m to q and returns the queue *Job, or an error if the dispatch failed.
func (*Queue) DispatchConfig ¶ added in v0.9.2
func (q *Queue) DispatchConfig(ctx context.Context, m postdog.Mail, cfg dispatch.Config) (*Job, error)
DispatchConfig does the same as Dispatch() but accepts a dispatch.Config instead if dispatch.Options.
Click to show internal directories.
Click to hide internal directories.