A collection of utilities function for Go used across Conversio. No reason this can't be open source right? :-)
import "github.com/getconversio/go-utils/services/amqp"
func StartListening() {
amqp.HandleFunc(
"myqueue", // Queue name
"myexchange", // Exchange name
"myrouting", // Routing key
new(mystruct),
func(msg interface{}, headers aq.Table) error {
doSomething(*msg.(*mystruct))
return nil
})
}
Basic testing:
$ docker-compose run --rm dev
Testing the package is the default command for the dev container. To create a coverage profile:
$ docker-compose run --rm dev ./test.sh cover