Documentation
¶
Index ¶
- Constants
- Variables
- type AckOptions
- type Acker
- type Counter
- type DequeueFunc
- type DequeueOptions
- type Dequeuer
- type EnqueueOptions
- type Enqueuer
- type ErrSkipRetry
- type Gauge
- type Handler
- type HandlerFunc
- type HeartBeater
- type HeartbeatData
- type HeartbeatQueueData
- type Job
- type JobOption
- type JobOptions
- type JobStatus
- type Logger
- type Metric
- type MetricRangeValue
- type MetricValue
- type Metrics
- type NackOptions
- type Pagination
- type Queue
- type QueueDetails
- type QueueError
- type QueueInfo
- type QueueManager
- type QueueStatus
- type Worker
- type WorkerOptions
Constants ¶
View Source
const ( MetricPendingQueueSize = "pending_queue_size" MetricDeadQueueSize = "dead_queue_size" MetricJobProcessedCount = "job_processed_count" MetricJobFailedCount = "job_failed_count" )
View Source
const DefaultNameSpace = "taskqueue"
Variables ¶
View Source
var ErrInvalidJobStatus = errors.New("invalid job status")
View Source
var ErrJobNotFound = errors.New("job not found")
Functions ¶
This section is empty.
Types ¶
type AckOptions ¶
type AckOptions struct {
QueueName string
}
type Acker ¶
type Acker interface { Ack(ctx context.Context, job *Job, opts *AckOptions) error Nack(ctx context.Context, job *Job, opts *NackOptions) error }
type DequeueFunc ¶
func (DequeueFunc) Dequeue ¶
func (f DequeueFunc) Dequeue(ctx context.Context, opts *DequeueOptions, count int) ([]*Job, error)
type DequeueOptions ¶
type EnqueueOptions ¶
type Enqueuer ¶
type Enqueuer interface {
Enqueue(ctx context.Context, job *Job, opts *EnqueueOptions) error
}
type ErrSkipRetry ¶ added in v1.1.0
func (ErrSkipRetry) Error ¶ added in v1.1.0
func (e ErrSkipRetry) Error() string
func (ErrSkipRetry) Unwrap ¶ added in v1.1.0
func (e ErrSkipRetry) Unwrap() error
type HandlerFunc ¶
type HeartBeater ¶
type HeartbeatData ¶
type HeartbeatQueueData ¶
type Job ¶
type Job struct { ID string QueueName string Payload []byte CreatedAt time.Time StartedAt time.Time UpdatedAt time.Time Attempts int FailureReason string Status JobStatus ProcessedBy string }
func (*Job) JSONMarshalPayload ¶
func (*Job) JSONUnMarshalPayload ¶
type JobOption ¶
type JobOption func(*JobOptions)
func WithConcurrency ¶
func WithIdleWaitTime ¶
func WithMaxAttempts ¶
func WithTimeout ¶
type JobOptions ¶
type MetricRangeValue ¶
type MetricRangeValue struct { Metric Metric Values []MetricValue }
type MetricValue ¶
type NackOptions ¶
type Pagination ¶
type QueueDetails ¶
type QueueDetails struct { NameSpace string Name string JobCount int Status QueueStatus Pagination Pagination Jobs []*Job }
type QueueError ¶
type QueueError int
const ( ErrUnknown QueueError = iota ErrQueueNotFound ErrQueueEmpty )
func (QueueError) Error ¶
func (err QueueError) Error() string
type QueueInfo ¶
type QueueInfo struct { NameSpace string Name string JobCount int Status QueueStatus }
type QueueManager ¶
type QueueManager interface { DeleteJobFromDeadQueue(ctx context.Context, queueName string, jobID string) error PausePendingQueue(ctx context.Context, queueName string) error ResumePendingQueue(ctx context.Context, queueName string) error ListPendingQueues(ctx context.Context) ([]*QueueInfo, error) ListDeadQueues(ctx context.Context) ([]*QueueInfo, error) PagePendingQueue(ctx context.Context, queueName string, p Pagination) (*QueueDetails, error) PageDeadQueue(ctx context.Context, queueName string, p Pagination) (*QueueDetails, error) }
type QueueStatus ¶
type QueueStatus int
const ( QueueStatusUnknown QueueStatus = iota QueueStatusPaused QueueStatusRunning )
func (QueueStatus) String ¶
func (s QueueStatus) String() string
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
func NewWorker(opts *WorkerOptions) *Worker
func (*Worker) RegisterHandler ¶
type WorkerOptions ¶
Click to show internal directories.
Click to hide internal directories.