https://github.com/koding/rabbitapi
Implementation of RabbitMq Management HTTP Api in Go
https://github.com/koding/rabbitapi
Last synced: 5 months ago
JSON representation
Implementation of RabbitMq Management HTTP Api in Go
- Host: GitHub
- URL: https://github.com/koding/rabbitapi
- Owner: koding
- License: mit
- Created: 2013-05-02T21:04:30.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-08-01T11:12:18.000Z (over 9 years ago)
- Last Synced: 2024-06-19T06:48:31.023Z (over 1 year ago)
- Language: Go
- Size: 18.6 KB
- Stars: 6
- Watchers: 14
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# rabbitapi
Implementation of [RabbitMq Management HTTP
Api](http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v3_1_0/priv/www/api/index.html)
in Go. Alpha status.
For more information and documenation please read [Godoc RabbitApi
page](http://godoc.org/github.com/koding/rabbitapi)
# setup
```
go get github.com/koding/rabbitapi
```
# example usage
First create a rabbitapi instance with your api credentials
```
r := rabbitapi.Auth("guest", "guest", "http://localhost:15672")
```
To get a list of all vhosts
```
vhosts, err := r.GetVhosts()
if err != nil {
fmt.Println(err)
} else {
fmt.Println("vhosts:", vhosts)
}
```
Create an exchange on vhost `/` with the name `rabbitapi`, `durable=false`,
`autoDelete=true`, `internal=false,` and `arguments=nil`
```
err = r.CreateExchange("/", "rabbitapi", "topic", false, true, false, nil)
if err != nil {
fmt.Println(err)
}
```
Get an exchange we created previously on the vhost `/`
```
exchange, err := r.GetExchange("/", "rabbitapi")
if err != nil {
fmt.Println(err)
}
fmt.Println(exchange) // exchange.Type is 'topic'
```
for more examples look into `*_test.go` files.