Documentation ¶
Index ¶
- Constants
- func UnmarshalMessageBody(message *sqs.Message, v interface{}) (err error)
- type Processor
- type Queue
- func (queue *Queue) DeleteMessage(message *sqs.Message) (resp *sqs.DeleteMessageOutput, err error)
- func (queue *Queue) DeleteMessageByReceiptHandle(receiptHandle *string) (resp *sqs.DeleteMessageOutput, err error)
- func (queue *Queue) GetAttributesByQueueURL(url string, attributeNames []*string) (resp *sqs.GetQueueAttributesOutput, err error)
- func (queue *Queue) GetClient() *sqs.SQS
- func (queue *Queue) Init() (err error)
- func (queue *Queue) ReceiveMessage() (message *sqs.Message, err error)
- func (queue *Queue) SendMessage(messageBody interface{}) (resp *sqs.SendMessageOutput, err error)
- type RedrivePolicy
Constants ¶
const MaxReceiveCountBeforeDead = 5
MaxReceiveCountBeforeDead is the receive count before a message is sent to a dead letter queue.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalMessageBody ¶
UnmarshalMessageBody will return a MessageBody struct from the given sqs.Message.
Types ¶
type Processor ¶
Processor represents a method that handles incoming sqs messages.
func (*Processor) Process ¶
func (processor *Processor) Process(body interface{})
Process handles incoming sqs messages. The body parameter is not typed, so we can decode the incoming message in a structure that is passed via this parameter. On passing nil, the Json marshaller will marshall it as map[string]interface{}.
Since we are passing the containing structure, this method is not threadsafe. On the other hand multiple Processors can process the same sqs queues parallel without any problem.
type Queue ¶
A Queue represents an SQS queue.
func (*Queue) DeleteMessage ¶
DeleteMessage removes a message from the Queue.
func (*Queue) DeleteMessageByReceiptHandle ¶
func (queue *Queue) DeleteMessageByReceiptHandle(receiptHandle *string) (resp *sqs.DeleteMessageOutput, err error)
DeleteMessageByReceiptHandle removes a message from the Queue by it's receiptHandle.
func (*Queue) GetAttributesByQueueURL ¶
func (queue *Queue) GetAttributesByQueueURL(url string, attributeNames []*string) (resp *sqs.GetQueueAttributesOutput, err error)
GetAttributesByQueueURL returns queue attributes by it's URL.
func (*Queue) ReceiveMessage ¶
ReceiveMessage will return one message and it's body from the queue.
func (*Queue) SendMessage ¶
func (queue *Queue) SendMessage(messageBody interface{}) (resp *sqs.SendMessageOutput, err error)
SendMessage will send message to the queue with the file path.
type RedrivePolicy ¶
type RedrivePolicy struct { MaxReceiveCount int `json:"maxReceiveCount"` DeadLetterTargetArn string `json:"deadLetterTargetArn"` }
A RedrivePolicy is an sqs policy of a dead letter queue.
func (RedrivePolicy) GetAsAWSString ¶
func (policy RedrivePolicy) GetAsAWSString() (policyString *string, err error)
GetAsAWSString returns the RedrivePolicy as a JSON string poninter for sqs attribute.