// listen listens to the SQS queue for intensity messages and saves them to the DB.
func listen() {
	rx, dx, err := sqs.InitRx()
	if err != nil {
		log.Fatalf("ERROR - problem creating SQS from config: %s", err)
	}

	for {
		r := <-rx
		m := message{}
		m.Decode([]byte(r.Body))
		if !msg.Process(&m) {
			dx <- r.ReceiptHandle
		}
	}
}
Exemple #2
0
func main() {
	rx, dx, err := sqs.InitRx()
	if err != nil {
		log.Fatalf("ERROR - problem creating SQS from config: %s", err)
	}

	log.Print("starting message listner")

	for {
		r := <-rx
		h := message{}
		h.Decode([]byte(r.Body))
		if !msg.Process(&h) {
			dx <- r.ReceiptHandle
		}
	}
}
Exemple #3
0
func main() {
	rx, dx, err := sqs.InitRx()
	if err != nil {
		log.Fatalf("ERROR - problem creating SQS from config: %s", err)
	}

	ttr, err = twitter.Init()
	if err != nil {
		log.Fatalf("ERROR: Twitter init error: %s", err.Error())
	}

	log.Printf("Twitter magnitude threshold %.1f", threshold)

	log.Print("starting message listner")

	for {
		r := <-rx
		h := message{}
		h.Decode([]byte(r.Body))
		if !msg.Process(&h) {
			dx <- r.ReceiptHandle
		}
	}
}