Exemplo n.º 1
0
// sendBatch to send batch messages.
func (s SQS) sendBatch(Bodies []string) (*sqs.SendMessageBatchOutput, error) {
	var entries []*sqs.SendMessageBatchRequestEntry
	entries = make([]*sqs.SendMessageBatchRequestEntry, len(Bodies))

	for i, body := range Bodies {
		entries[i] = &sqs.SendMessageBatchRequestEntry{
			ID:          aws.String(string(97 + i)),
			MessageBody: aws.String(string(utils.Base64Encode([]byte(body)))),
		}
	}
	return s.sqs.SendMessageBatch(&sqs.SendMessageBatchInput{
		Entries:  entries,
		QueueURL: s.url,
	})
}
Exemplo n.º 2
0
// Send to send a queue message.
func (s SQS) Send(Body string) (*sqs.SendMessageOutput, error) {
	return s.sqs.SendMessage(&sqs.SendMessageInput{
		MessageBody: aws.String(string(utils.Base64Encode([]byte(Body)))),
		QueueURL:    s.url,
	})
}