<p>Your own queue listener should attempt to declare the exchange, using the same settings as Nova does. </p>
<p>If the exchange exists, its a noop. Otherwise it's created for you.</p>
<p>After that, if you start up Nova, it will do the same and reuse your exchange.</p>
<p>Obviously this works both ways, and either nova or your code can declare the exchange.</p>
<p>AMQP is designed to be a configuration-less protocol, where resources are configured by the first consumer attempting to use them.<br></p>
<p>Thanks,<br>
Kiall</p>
<p>Sent from my phone.</p>
<div class="gmail_quote">On May 9, 2012 9:52 a.m., "Day, Phil" <<a href="mailto:philip.day@hp.com">philip.day@hp.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Doug,<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal">> I think you missed my main point, which was that a topic exchange does<br>
> not impose a limitation that only one client can consume a given<br>> notification.  That's only true if each client is consuming from the<br>> same queue bound to the exchange.<u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So just to be clear, if I understand you correctly within the nova service/rpc abstraction layers the code is set up so that all services do bind to the same queue, and hence we get the round-robin delivery.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">But, if someone wanted to write a separate notification consumer so that they didn’t block anyone else from seeing the same messages then they (the consumer) should create a new queue on the existing topic exchange.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Is that correct – and is there any worked example of doing this ?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I thought within the nova code both the exchange and topic queues were set up by the consumer (so for example all compute_managers try to create the “compute” exchange and topic queue, but its only created by the first one and the others connect to the same queue).   In that context I’m finding it hard to see how to change this model to have multiple “<a href="http://notify.info" target="_blank">notify.info</a>” topic queues into the same exchange ?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Phil<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> openstack-bounces+philip.day=<a href="mailto:hp.com@lists.launchpad.net" target="_blank">hp.com@lists.launchpad.net</a> [mailto:<a href="mailto:openstack-bounces%2Bphilip.day" target="_blank">openstack-bounces+philip.day</a>=<a href="mailto:hp.com@lists.launchpad.net" target="_blank">hp.com@lists.launchpad.net</a>] <b>On Behalf Of </b>Doug Hellmann<br>
<b>Sent:</b> 08 May 2012 23:34<br><b>To:</b> Russell Bryant<br><b>Cc:</b> <a href="mailto:openstack@lists.launchpad.net" target="_blank">openstack@lists.launchpad.net</a><br><b>Subject:</b> Re: [Openstack] [nova] why does notification use a "topic" exchange instead of "fanout"?<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div><p class="MsoNormal">On Tue, May 8, 2012 at 6:04 PM, Russell Bryant <<a href="mailto:rbryant@redhat.com" target="_blank">rbryant@redhat.com</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal" style="margin-bottom:12.0pt">On 05/08/2012 05:59 PM, Doug Hellmann wrote:<br>>     Here is a relevant section pulled out of the amqp 0-9-1 spec:<br>><br>>        3.1.3.3 The Topic Exchange Type<br>
><br>>        The topic exchange type works as follows:<br>><br>>            1. A message queue binds to the exchange using a routing<br>>               pattern, P.<br>>            2. A publisher sends the exchange a message with the routing<br>
>               key R.<br>>            3. The message is passed to the message queue if R matches P.<br>><br>>        The routing key used for a topic exchange MUST consist of zero or<br>>        more words delimited by dots. Each word may contain the letters A-Z<br>
>        and a-z and digits 0-9.<br>><br>>        The routing pattern follows the same rules as the routing key with<br>>        the addition that * matches a single word, and # matches zero or<br>>        more words. Thus the routing pattern *.stock.# matches the routing<br>
>        keys usd.stock and eur.stock.db but not stock.nasdaq.<br>><br>>     In nova, for a given topic such as 'scheduler', all of the consumers are<br>>     binding to the same queue on the topic exchange, resulting in<br>
>     round-robin delivery to each of the consumers.  If instead you make a<br>>     new queue, you can get your own copy of each message.<br>><br>>     There is an additional benefit of using a topic exchange here.  The<br>
>     topic used for notifications is 'notifications.<priority>'.  That means<br>>     that when you create your queue, you can set it up to receive all<br>>     notifications, or only notifications of a certain priority.<br>
><br>><br>> Topic exchanges make a lot of sense for messages that should only be<br>> consumed once, such as tasks. Notifications are different. Lots of<br>> different clients might want to know that some event happened in the<br>
> system. The way things are in Nova today, they can't. The first client<br>> who consumes a notification message will prevent all of the other<br>> clients from seeing that message at all.<u></u><u></u></p></div>
</div><p class="MsoNormal">I think you missed my main point, which was that a topic exchange does<br>not impose a limitation that only one client can consume a given<br>notification.  That's only true if each client is consuming from the<br>
same queue bound to the exchange.<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Yes, that wasn't obvious from any of the kombu documentation I've seen so far. I'll keep looking.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Doug<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>> I can change Nova's notification system to use a fanout exchange (in<br>> impl_kombu.py changing the exchange type used by NotifyPublisher), but<br>> before I submit a patch I want to make sure the current implementation<br>
> using a topic exchange wasn't selected deliberately for some reason.<u></u><u></u></p></div><p class="MsoNormal">I think using a fanout exchange would be a downgrade.  As I mentioned<br>before, a topic exchange allows you to create a queue to get all<br>
notifications or only notifications of a specific priority.  If the<br>exchange type is changed to fanout, it's everybody gets everything, and<br>that's it.<br><span style="color:#888888"><br><span>--</span><br><span>Russell Bryant</span></span><u></u><u></u></p>
</blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div><br>_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
<br></blockquote></div>