func proxySNS(q *sqs.Queue, msgs []sqs.Message) {

	_, respErr := q.SendMessageBatch(msgs)
	if respErr != nil {
		log.Println("ERROR:", respErr)
	}
}
Beispiel #2
0
// process a message from the SQS queue. This should be run inside a goroutine.
func processMessage(q *sqs.Queue, m sqs.Message, wo work_order.WorkOrder, wg *sync.WaitGroup) {
	logger.Debug("Starting process on %d from '%s'", wo.Id, m.MessageId)

	// start heartbeat
	beat := heartbeat.Start(q, &m)

	// execute the work
	err := wo.Execute()
	if err != nil {
		logger.Error("Error executing: %d - %v", wo.Id, err)
	}

	// send response back to devops-web
	wo.Report()

	// stop the heartbeat
	beat.Stop()

	// delete message
	logger.Debug("Deleting message: %s", m.MessageId)
	_, err = q.DeleteMessage(&m)
	if err != nil {
		logger.Error("ERROR: Couldn't delete message: %s - %v", m.MessageId, err)
	}

	// exit this goroutine
	wg.Done()
}
Beispiel #3
0
func addToQuestionQ(msgList []sqs.Message, sqsQ sqs.Queue) {
	_, respErr := sqsQ.SendMessageBatch(msgList)
	if respErr != nil {
		log.Println("ERROR:", respErr)
	}
}