开发者

Calculating average round-trip times (AMQP/RabbitMQ)

Given a cluster of RabbitMQ nodes with a bunch of queues getting messages from a开发者_JAVA技巧 topic exchange, I would like to be able to programmatically answer the question:

For queue X, what is the current rough estimate on message delivery/roundtrip times?

Using the RabbitMQ management plugin's API for introspection, I can think of a whole bunch of ways of doing it, none of which would be terribly hard to implement ([number of queued messages + 1] * average processing time), but it all kind of feels a bit like reinventing the wheel. Are there any established best practices? Maybe even some out-of-the-box mechanisms provided by RabbitMQ?

(For the record, we're talking to RabbitMQ 2.4.1 from Ruby, using good old bunny 0.6.0 with some custom abstraction code on top.)


I've implemented PoC to do something like what you ask using the RabbitMQ Erlang client. You can see a demo of that here: http://vimeo.com/20966661

The pattern used is called Smart Proxy as explained on the Enterprise Integration Patterns book.

Then to see a code example take a look at this library: https://github.com/videlalvaro/rmq_patterns

Look for the amqp_smart_proxy.erl file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜