2018-08-15 17:00:24 -03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/eventials/goevents/messaging"
|
|
|
|
"github.com/eventials/goevents/sns"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2018-08-15 17:42:10 -03:00
|
|
|
consumer := sns.MustNewConsumer(&sns.ConsumerConfig{
|
2018-08-15 17:00:24 -03:00
|
|
|
AccessKey: "",
|
|
|
|
SecretKey: "",
|
|
|
|
Region: "us-east-1",
|
|
|
|
QueueUrl: "https://sqs.us-east-1.amazonaws.com/0000000000/vlab-exams-mp4-dev",
|
|
|
|
})
|
|
|
|
|
|
|
|
consumer.Subscribe("arn:aws:sns:us-east-1:0000000000:test", func(e messaging.Event) error {
|
2018-08-15 18:00:19 -03:00
|
|
|
fmt.Println("Action:\t", e.Action)
|
|
|
|
fmt.Println("Body:\t", string(e.Body))
|
2018-08-15 17:00:24 -03:00
|
|
|
return nil
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
consumer.Subscribe("arn:aws:sns:us-east-1:0000000000:test2", func(e messaging.Event) error {
|
2018-08-15 18:00:19 -03:00
|
|
|
fmt.Println("Action:\t", e.Action)
|
|
|
|
fmt.Println("Body:\t", string(e.Body))
|
2018-08-15 17:00:24 -03:00
|
|
|
return nil
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
consumer.Consume()
|
|
|
|
}
|