taskqueue

package
v0.85.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(ctx context.Context, taskMsg *task.Message) error

Handler is a handler for a message received from a task queue.

If the task is long-lived, the task should periodically check the given context and stop if it is cancelled.

If the task did not complete (and should be retried later), an error should be returned. Otherwise, it should return nil. The handler should handle any error logging as Processor implementations are not required to do so.

Note that the task queue Processor is not expected to perform error logging, should the Handler encounter an error.

type Processor

type Processor interface {
	Submitter

	Start()
	Pause()
	Shutdown()
}

Processor processes messages from the task queue.

Processors may also act as submitters.

type ProcessorCtor

type ProcessorCtor func(handler Handler) (Processor, error)

ProcessorCtor creates a new Processor configured with the provided Handler.

type Submitter

type Submitter interface {
	Submit(ctx context.Context, msg *task.Message) error
	SubmitBatch(ctx context.Context, msgs []*task.Message) error
}

Submitter submits messages to the task queue.

Directories

Path Synopsis
model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL