[rabbitmq-discuss] Publish messages only when needed ?
matthias at rabbitmq.com
Fri Oct 8 10:18:56 BST 2010
Romain Conseil wrote:
> as you will see in the previous message, I tested the two settings for
> exchanges (with x-lvc / with direct) : the difference is only 10% oc CPU
> load and is still at 120% with direct exchanges.
Missed that, sorry. And thinking about it, 120% CPU for a 10kHz
publisher stream sounds about right - I get similar figures on my machine.
> the problem is to have a routeIds list uptodate which requires :
> - to know the all list of bindings at pblisher startup
> - to be notify of each new binding when running.
> Would this be possible ?
You could write a custom exchange type that captures the bind/unbind
events. It would maintain internal state (in mnesia, perhaps) to count
the number of bindings per routeId. Whenever that count transitions
between zero and non-zero it would publish an message to an exchange,
with the routeId as the routing key.
Producers could then bind to that exchange to receive a stream of
bind/unbind events relevant to them. And making that exchange an lvc
exchange allows new producers to learn about the current state.
More information about the rabbitmq-discuss