job

package
v0.0.0-...-58d095e Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const LogJobName = "log"

LogJobName is LogJob's unique identifier.

Variables

This section is empty.

Functions

func Do

func Do(ctx context.Context, message events.SQSMessage) (context.Context, error)

Do parses the SQS message and invokes Job.Do.

Types

type Job

type Job interface {
	Do(context.Context) (context.Context, error)
}

Job is the interfce implemented by jobs.

func NewLogJob

func NewLogJob() Job

NewLogJob returns a LogJob.

type LogJob

type LogJob struct{}

LogJob is a job that simply prints a log message.

func (LogJob) Do

func (j LogJob) Do(ctx context.Context) (context.Context, error)

Do implements Job.Do by printing a log message.

type Message

type Message struct {
	Job string `json:"job"`
}

Message models a job message sent to the queue.

func NewMessage

func NewMessage(job string) Message

NewMessage returns an initialized Message.

func (Message) String

func (m Message) String() string

String implementes Stringer by marshaling the message to JSON.

type NewJob

type NewJob = func() Job

NewJob is a function definition for functions that return initialized Jobs.

Jump to

Keyboard shortcuts

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