queue

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CommandScheduleDeployment string = "api-schedule-deployment"
	CommandUpdateDeployment   string = "api-update-deployment"
	CommandCallbackMessage    string = "api-callback-message"
)

API Queue Commands

View Source
const (
	CommandDeployNamespace string = "sch-deploy-namespace"
	// CommandRestartNamespace is the command used for scheduling a service restart in a namespace
	CommandRestartNamespace string = "sch-restart-namespace"
)

Scheduler Queue Commands

View Source
const (
	MessageAttributeReqID   string = "x_req_id"
	MessageAttributeCommand string = "eve_cmd"
	MessageAttributeID      string = "eve_id"
)

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(ctx context.Context) *zap.Logger

Types

type Config

type Config struct {
	MaxNumberOfMessage int64  `split_words:"true" default:"10"`
	QueueURL           string `split_words:"true" required:"true"`
	WaitTimeSecond     int64  `split_words:"true" default:"20"`
	VisibilityTimeout  int64  `split_words:"true" default:"3600"`
}

Config struct

type Handler

type Handler interface {
	HandleMessage(ctx context.Context, msg *M) error
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, msg *M) error

HandlerFunc is used to define the Handler that is run on for each message

func (HandlerFunc) HandleMessage

func (f HandlerFunc) HandleMessage(ctx context.Context, msg *M) error

HandleMessage wraps a function for handling sqs messages

type M

type M struct {
	ID            uuid.UUID
	GroupID       string
	Body          json.Object
	ReceiptHandle string
	MessageID     string
	Command       string
	DedupeID      string
}

type Q

type Q struct {
	// contains filtered or unexported fields
}

func NewQ

func NewQ(sess *session.Session, config Config) *Q

func (*Q) Delete

func (q *Q) Delete(ctx context.Context, m *M) error

func (*Q) Message

func (q *Q) Message(ctx context.Context, m *M) error

func (*Q) Receive

func (q *Q) Receive(ctx context.Context) ([]*mContext, error)

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(name string, q *Q, timeout time.Duration) *Worker

func (*Worker) DeleteMessage

func (worker *Worker) DeleteMessage(ctx context.Context, m *M) error

func (*Worker) Message

func (worker *Worker) Message(ctx context.Context, qUrl string, m *M) error

func (*Worker) Start

func (worker *Worker) Start(h Handler)

func (*Worker) Stop

func (worker *Worker) Stop()

Jump to

Keyboard shortcuts

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