lsqs

package
v0.0.0-...-d475280 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const FmtURL = "%s://%s/%s/%s"

FmtURL defines the format of a Queue URL

Variables

View Source
var (
	// ErrAlreadyExists maps to QueueAlreadyExists
	ErrAlreadyExists = errors.New("already exists")
	// ErrNonExistentQueue maps to NonExistentQueue
	ErrNonExistentQueue = errors.New("non existent queue")
	// ErrInvalidParameterValue maps to InvalidAttributeValue
	ErrInvalidParameterValue = errors.New("invalid parameter value")
	// ErrInvalidAttributeName maps to InvalidAttributeName
	ErrInvalidAttributeName = errors.New("invalid attribute name")
)

Functions

func Start

func Start(accountID, region, scheme, host string, stopC <-chan struct{}) chan<- Action

Start a new LSQS instance with the given configuration and returns a channel to communicate with it.

Types

type Action

type Action func(l *lSqs)

Action to be executed on the given LSQS instance. The instance type is not exported so the user can not call these actions directly, making the pushC returned on Start the only way to communicate with an instance.

func CreateQueue

func CreateQueue(
	parameters map[string]string,
	attributes map[string]string,
	resC chan<- ReqResult,
) Action

CreateQueue creates a new standard or FIFO queue. You can pass one or more attributes in the request. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html

func DeleteMessage

func DeleteMessage(parameters map[string]string, resC chan<- ReqResult) Action

DeleteMessage deletes the specified message from the specified queue. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteMessage.html

func DeleteQueue

func DeleteQueue(parameters map[string]string, resC chan<- ReqResult) Action

DeleteQueue deletes the queue specified by the QueueUrl, regardless of the queue's contents. If the specified queue doesn't exist, Amazon SQS returns a successful response. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteQueue.html

At the time of writing this method, the AWS doc states that if deleting an non-existing queue, no error is returned, but testing with the aws-cli it returns an 'AWS.SimpleQueueService.NonExistentQueue'.

Currently the queue is immediately deleted (no 60 sec limit as stated by AWS docs)

func GetQueueAttributes

func GetQueueAttributes(
	parameters map[string]string,
	attributes map[string]string,
	resC chan<- ReqResult,
) Action

GetQueueAttributes gets attributes for the specified queue. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_GetQueueAttributes.html

func GetQueueURL

func GetQueueURL(parameters map[string]string, resC chan<- ReqResult) Action

GetQueueURL returns the URL of an existing Amazon SQS queue. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_GetQueueUrl.html

func ListDeadLetterSourceQueues

func ListDeadLetterSourceQueues(parameters map[string]string, resC chan<- ReqResult) Action

ListDeadLetterSourceQueues returns a list of your queues that have the RedrivePolicy queue attribute configured with a dead-letter queue. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ListDeadLetterSourceQueues.html

func ListQueues

func ListQueues(parameters map[string]string, resC chan<- ReqResult) Action

ListQueues returns a list of your queues. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ListQueues.html

func PurgeQueue

func PurgeQueue(parameters map[string]string, resC chan<- ReqResult) Action

PurgeQueue deletes the messages in a queue specified by the QueueURL parameter. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_PurgeQueue.html

func ReceiveMessage

func ReceiveMessage(reqID string, parameters map[string]string, resC chan<- ReqResult) Action

ReceiveMessage retrieves one or more messages (up to 10), from the specified queue. Using the WaitTimeSeconds parameter enables long-poll support. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html

func SendMessage

func SendMessage(parameters map[string]string, resC chan<- ReqResult) Action

SendMessage delivers a message to the specified queue. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html

func SetQueueAttributes

func SetQueueAttributes(
	parameters map[string]string,
	attributes map[string]string,
	resC chan<- ReqResult,
) Action

SetQueueAttributes sets the value of one or more queue attributes. Unlike SQS, the changes are immediate. More info at: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.html

type LSqs

type LSqs interface {
	Process(<-chan Action, <-chan struct{})
}

LSqs is the interface to implement if you want to implement your own SQS service.

type Message

type Message struct {
	Body             []byte
	CreatedTimestamp time.Time
	DelaySeconds     time.Duration
	MessageID        string
	Md5OfMessageBody string
	ReceiptHandle    string
	Received         uint32
	// contains filtered or unexported fields
}

Message represents a Queue's message.

type ReqResult

type ReqResult struct {
	Data interface{}
	Err  error
	// extra data to be used by some errors like custom messages
	ErrData interface{}
}

ReqResult contains the result of any request to LSQS.

Jump to

Keyboard shortcuts

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