[rabbitmq-discuss] Publish messages only when needed ?

Marek Majkowski majek04 at gmail.com
Thu Oct 7 16:18:34 BST 2010


> I try to find some ways to enhance this. So my question : would it be
> possible to publish essages to the exchange only if there is at least one
> consumer that subscribed this message ? In other words, I would like to
> implement a kind of binding listener on exchanges and a way to request the
> list of bindings (in Java).
>
> I searched the api and it doesn't seem to be available. I am also aware that
> this breaks the publisher/subscriber model since the publisher doesn't have
> to carry about diffusion, it just publishes.

Have you looked at the "immediate" and "mandatory" flags in basic.publish?

>From http://www.rabbitmq.com/api-guide.html:
"If a message is published with the "mandatory" or "immediate" flags
set, but cannot be delivered, the broker will return it to the sending
client (via a AMQP.Basic.Return command)."


Cheers,
  Marek


More information about the rabbitmq-discuss mailing list