michaelklishin / rabbit-hole Goto Github PK
View Code? Open in Web Editor NEWRabbitMQ HTTP API client in Go
License: BSD 2-Clause "Simplified" License
RabbitMQ HTTP API client in Go
License: BSD 2-Clause "Simplified" License
This is easily accessible via GET /api/overview
but it's a bit difficult to discover.
/api/overview response:
{"management_version":"3.5.1","rates_mode":"basic","exchange_types":[{"name":"topic","description":"AMQP topic exchange, as per the AMQP specification","enabled":true},{"name":"fanout","description":"AMQP fanout exchange, as per the AMQP specification","enabled":true},{"name":"direct","description":"AMQP direct exchange, as per the AMQP specification","enabled":true},{"name":"headers","description":"AMQP headers exchange, as per the AMQP specification","enabled":true}],"rabbitmq_version":"3.5.1","cluster_name":"rabbit@localhost","erlang_version":"17","erlang_full_version":"Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:4:4] [async-threads:30] [hipe] [kernel-poll:true]","message_stats":{},"queue_totals":{"messages":0,"messages_details":{"rate":0.0},"messages_ready":0,"messages_ready_details":{"rate":0.0},"messages_unacknowledged":0,"messages_unacknowledged_details":{"rate":0.0}},"object_totals":{"consumers":0,"queues":1,"exchanges":8,"connections":0,"channels":0},"statistics_db_event_queue":0,"node":"rabbit@localhost","statistics_db_node":"rabbit@localhost","listeners":[{"node":"rabbit@localhost","protocol":"amqp","ip_address":"127.0.0.1","port":5672},{"node":"rabbit@localhost","protocol":"clustering","ip_address":"::","port":25672},{"node":"rabbit@localhost","protocol":"mqtt","ip_address":"::","port":1883},{"node":"rabbit@localhost","protocol":"stomp","ip_address":"::","port":61613}],"contexts":[{"node":"rabbit@localhost","description":"RabbitMQ Management","path":"/","port":"15672"}]}
in contexts
item:
{"node":"rabbit@localhost","description":"RabbitMQ Management","path":"/","port":"15672"}
field "port" is of type string instead of expected int.
According to go docs (https://golang.org/src/net/http/response.go?s=1408:1586#L19), unless response.Body is read to completion AND closed, default http.client’s transport will not reuse keep-alive connections.
I'd like to add the consumer_utilisation
in the QueueInfo
struct but I'm not sure how to achieve this without using a more flexible unpacking routine than encoding/json
.
On the wire, an empty value looks like this:
"consumer_utilisation":"",
And a populated value looks like this:
"consumer_utilisation": 0.04539788196622643,
So if I try, this will work for the empty value, but blows up with a populated value:
ConsumerUtilisation string `json:"consumer_utilisation"`
Conversely, if I try
ConsumerUtilisation float64 `json:"consumer_utilisation"`
This will unpack the the populated float but will blow up with an empty string.
The option
ConsumerUtilisation float64 `json:"consumer_utilisation,string"`
doesn't seem to handle the empty string either.
Another approach might be to ask RabbitHQ if this could get patched on the server, but this might end up breaking other clients, and is only available from a certain release forwards.
Any ideas on how to proceed?
Go http.NewRequest
(url.Parse
?) decodes percent-encoding paths, resulting in 404s.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.