Пример #1
0
func handleMessage(q *queue.Queue, m *sqs.Message, h Handler) error {
	var err error
	err = h.HandleMessage(m)
	if err != nil {
		return err
	}
	return q.DeleteMessage(m.ReceiptHandle)
}
Пример #2
0
func Start(q *queue.Queue, h Handler) {
	for {
		log.Println("worker: Start polling")
		messages, err := q.ReceiveMessage(option.MaxNumberOfMessages(10))
		if err != nil {
			log.Println(err)
			continue
		}
		if len(messages) > 0 {
			run(q, h, messages)
		}
	}
}