I've come across a situation that's semi-obvious in retrospect given what I know of RabbitMQ, but nonetheless escaped me till now.<br><br>I've written a variety of automation code in Python using the rabbitmq management API. Things like purging queues, dumping queue contents to files, simulating broker failover, etc...<br>
<br>Today I created a situation where I knew that there was an unacknowledged message in a queue, and I could observe that was the case via the Web UI. However, my code was getting a value of '0' for the messages_unacknowledged column from /api/queues.<br>
<br>I eventually figured out that my HTTP call occurred before the default five second statistics database update. Thus, if I waited a few seconds before issuing the call, I got back the expected value of '1'.<br>
<br>Now, some of my automation depends on the values I get from the HTTP API to be correct "now", rather than behind by some non-trivial interval.<br><br>Now, I realize that this is an inherently racy circumstance. I'm just trying to reduce the window as much as possible. As I see it, I have three options:<br>
<ul><li>Crank up the default update interval, suppressing perf as I go to smaller intervals</li><li>Somehow query the broker in the same way that rabbitmqctl does. I assume this involves writing Erlang code, which I'd like to avoid for time reasons.</li>
<li>Call rabbitmqctl and capture/parse the output.<br></li></ul>Again, I realize that any solution is inherently only a snapshot in time - Thoughts on how to best achieve the most recently correct values, ideally in Python and without learning Erlang? :-)<br>
<br>Thanks,<br><br>Matt<br>