sqs

package
v0.0.0-...-60eb10a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SQSClient         SQSStruct
	MaxCountMessage   int64 = 10
	VisibilitySeconds int64 = 10
	WaitSeconds       int64 = 10
)
View Source
var MAX_BATCH_MESSAGE_COUNT = 10
View Source
var MAX_SQS_BATCH_SIZE_KB = 150

Max batch size of messages that can be sent to SQS This is excluding the metadata that is sent along with the message

Functions

func Decode

func Decode(value []byte) ([]byte, error)

*

  • Decodes the value using base64

func Delete

func Delete(ReceiptHandle *string) (*sqs.DeleteMessageOutput, error)

*

  • Delete a message from SQS queue

func Encode

func Encode(value []byte) []byte

*

  • Encodes the value in base64

func Initialize

func Initialize(options ...func() error) error

*

func New

func New(queue, region, id, secret, token string) func() error

*

  • Create SQS client using required AWS params (including creds)

func NewUsingConfig

func NewUsingConfig(queue string, config *aws.Config) func() error

*

  • Create SQS client using AWS config

func Purge

func Purge() (*sqs.PurgeQueueOutput, error)

*

  • Purge all messages from SQS queue

func Receive

func Receive() (*sqs.ReceiveMessageOutput, error)

*

  • Receive messages from SQS queue

func Send

func Send(message string) (*sqs.SendMessageOutput, error)

*

  • Send message to SQS queue

func SendBatch

func SendBatch(messages []string) (*sqs.SendMessageBatchOutput, error)

*

  • Send messages in batch to SQS
  • This reduces the number of calls to SQS, also it reduces the cost as well :)

func SendFifo

func SendFifo(message []byte, messageGroupID string, messageDeduplicationID string) (*sqs.SendMessageOutput, error)

SendFifo ....

func SetMaxCountMessage

func SetMaxCountMessage(maxCount int64) func() error

*

  • Sets the max count of message that can be returned by Amazon SQS
  • The value can range between 1 to 10

func SetVisibilitySeconds

func SetVisibilitySeconds(timeout int64) func() error

*

  • Sets the duration for which the received messages are hidden from subsequent retrieve requests

func SetWaitSeconds

func SetWaitSeconds(waitTime int64) func() error

*

  • Sets the duration for which the call waits for a message to appear in queue

Types

type SQSMessageBatchOutput

type SQSMessageBatchOutput struct {
	Output *sqs.SendMessageBatchOutput
	Error  error
}

SQS message batch output

func ProcessAndSendBatch

func ProcessAndSendBatch(messages []string) []*SQSMessageBatchOutput

*

  • Group all messages into chunks of 256 KB each and then send these chunks to SQS

type SQSStruct

type SQSStruct struct {
	SQS *sqs.SQS
	URL string
}

Jump to

Keyboard shortcuts

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