> > > > > >Ok. this makes more sense as I think there would not be too many > >subscribers. > >So you would notify publisher that a new queue has been created? > >Otherwise how does publisher push the events out? > > Generally idea of pub-sub model is that publisher/subscriber need not be > aware the existence of others. In the AMQP case, publisher just publishes > events to exchanges and not bother about the consumers. A subscriber > interested in a particular set of messages, will create a queue bound to > exchange with a binding key with pattern that describes interested messages. > It is message broker responsibility to match the message in exchange with all > binding key of the queue and deliver the message into queue if message's > routing key matches with binding key. So CloudStack just publishes messages > to an exchange, and creates a queue for each subscriber and sets up call back > to get notified If message gets into a queue.
Sorry, I may have not made my question clear. Publisher doesn't have to be aware of consumer, but it must know the binding key. Now I reread the below statement I think I got your idea is: When subscriber subscribes an event, the framework creates the queue and notifies binding key to publisher. >>So, when a subscriber registers with event bus with interested topic as 'all >>virtual machine events corresponding to >>VM with UUID 9d827485-0f46-4db8-bd39-fede97cbac0c' then a queue is created >>which will be attached to exchange >>with binding key "*.*.*.VirtualMachine.9d827485-0f46-4db8-bd39-fede97cbac0c".