Documentation ¶
Overview ¶
Package sqs provides publisher and receiver to interact with AWS SQS.
Index ¶
- type Client
- func (client *Client) Ack(queueName string, receiptHandle *string) error
- func (client *Client) Receive(queueName string) ([]RawMessage, error)
- func (client *Client) Send(message interface{}, queueName string) (*string, error)
- func (client *Client) SendAttributedMessage(message interface{}, queueName string, attributes map[string]string) (*string, error)
- type Consumer
- type Publisher
- type RawMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to AWS SQS to send and receive messages.
func (*Client) Ack ¶ added in v1.1.0
Confirm that the message was received. This will delete this message from given queue.
func (*Client) Receive ¶
func (client *Client) Receive(queueName string) ([]RawMessage, error)
Receive will try to read message from given queue.
func (*Client) Send ¶
Send will marshal passed message and try to deliver it to AWS SQS. If successful it returns the message id.
func (*Client) SendAttributedMessage ¶ added in v1.0.3
func (client *Client) SendAttributedMessage(message interface{}, queueName string, attributes map[string]string) (*string, error)
SendAttributedMessage will marshal given message to JSON if it's not already a byte array, try to send it to AWS SQS using passed message attributes and will return the message id in case of successful delivering.
type Consumer ¶
type Consumer interface { // Receive will read messages from given queue in AWS SQS. Receive(string) ([]RawMessage, error) // Confirm that the message was received. This will delete this message from given queue. Ack(string, *string) error }
Consumer provides read access to message queues in AWS SQS.
func NewConsumer ¶
NewConsumer returns a client to read messages from an AWS SQS queue.
type Publisher ¶
type Publisher interface { // Send will marshal given message to JSON if it's not already a byte array, // try to send it to AWS SQS and will return the message id in case of successful delivering. Send(interface{}, string) (*string, error) // SendAttributedMessage will marshal given message to JSON if it's not already a byte array, // try to send it to AWS SQS using passed message attributes and will return the message id // in case of successful delivering. SendAttributedMessage(interface{}, string, map[string]string) (*string, error) }
Publisher provides message sending functionality.
func NewPublisher ¶
NewPublisher returns a new publisher used to send messages to AWS SQS.
type RawMessage ¶
type RawMessage struct { // MessageId is the id of a message in AWS SQS. MessageId *string // ReceiptHandle is the receipt handle in AWS SQS. ReceiptHandle *string // Body contains the message body read from AWS SQS. Body *string }
RawMessage is used to return messages read from a queue in AWS SQS.