sqs

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageAttributeType        = "Type"
	MessageAttributeClusterName = "ClusterName"

	// ClusterUpdateEvent refers to an update of the Cluster object that
	// is sent by the client controller. This event is sent to the SQS queue and
	// is consumed by the API server which reconciles the DB.
	ClusterUpdateEvent = "cluster-update"

	// PartialClusterUpdateEvent refers to an update of the ClusterSync object on the
	// management cluster which is sent by the sync controller. This event is sent to
	// the SQS queue and is consumed by the sync client which creates/updates the
	// Cluster object on the cluster.
	PartialClusterUpdateEvent = "partial-cluster-update"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.6.0

type Config struct {
	AWSRegion string
	QueueName string
	Endpoint  string
	QueueURL  string

	// Maximum number of time to attempt AWS service connection
	MaxRetries int

	// Maximum number of messages to retrieve per batch
	BatchSize int64

	// The maximum poll time (0 <= 20)
	WaitSeconds int64

	// Once a message is received by a consumer, the maximum time in seconds till others can see this
	VisibilityTimeout int64

	// Poll only once and exit
	RunOnce bool

	// Poll every X seconds defined by this value
	RunInterval int

	// Maximum number of handlers to spawn for batch processing
	MaxHandlers int

	// BusyTimeout in seconds
	BusyTimeout int
	// contains filtered or unexported fields
}

func NewSQS

func NewSQS(cfg Config) (*Config, error)

NewSQS - create new SQS instance

func (*Config) ChangeVisibilityTimeout added in v1.6.0

func (s *Config) ChangeVisibilityTimeout(msg *sqs.Message, seconds int64) bool

ChangeVisibilityTimeout : Method to change visibility timeout of a message.

func (*Config) Delete added in v1.6.0

func (s *Config) Delete(msg *sqs.Message) error

Delete a SQS message from the queue

func (*Config) Enqueue added in v1.6.0

func (s *Config) Enqueue(ctx context.Context, msgBatch []*sqs.SendMessageBatchRequestEntry) error

Enqueue messages to SQS

func (*Config) Poll added in v1.6.0

func (s *Config) Poll()

Poll for messages in the queue

func (*Config) RegisterHandler added in v1.6.0

func (s *Config) RegisterHandler(handler func(msg *sqs.Message))

RegisterHandler : A method to register a custom Poll Handling method

func (*Config) Status added in v1.6.0

func (s *Config) Status() error

type Event added in v1.6.0

type Event struct {
	Type    string
	Message *awssqs.Message
}

func NewEvent added in v1.6.0

func NewEvent(msg *awssqs.Message) (*Event, error)

type EventHandler added in v1.6.0

type EventHandler interface {
	Type() string
	Handle(event *Event) error
}

type SQS added in v1.6.0

type SQS interface {
	Poll()
	Delete(msg *sqs.Message) error
	Enqueue(msgBatch []*sqs.SendMessageBatchRequestEntry) error
	RegisterHandler(handler func(msg *sqs.Message))
	ChangeVisibilityTimeout(msg *sqs.Message, seconds int64) bool
	Status() error
}

Jump to

Keyboard shortcuts

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