Pietro Mascolo
iz4vve@gmail.com
A lightweight client for publishing/subscribing on RabbitMQ.
$ go get -u -v github.com/iz4vve/rabbitmq-client
connector := rabbit.NewConnector()
connString := "amqp://<user>:<password>@<host>:<port>"
connector.Dial(connString)
connector.PublishOnQueue(jsonPayload, qName, exchName)
connector.SubscribeToQueue(qName, consumerName, callback, closeCh)
Remember to close a connection when not needed anymore.
To do so, send a value to the close channel you used for the subscription, and call close on the connection.
This is best setup when instantiating the connector.
connector := rabbit.NewConnector()
defer connector.Close()
...
connector.SubscribeToQueue(qName, consumerName, callback, closeCh)
defer func() {closeCh <- true} ()