예제 #1
0
파일: sqs.go 프로젝트: toomore/simpleaws
// 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,
	})
}
예제 #2
0
파일: sqs.go 프로젝트: toomore/simpleaws
// 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,
	})
}