<p>Hi Brian, no you definitely don't need to create any queues manually for the federation to work. Once you federate an exchange the exchange is created by the plugin on the downstream server (it has to exist on the upstream instead) and when you bind a queue to the federated exchange on the downstream server the bindings are sent to the upstream, which will deliver just the interesting messages published to the exchange on the upstream server to the downstream server. In other words it should work quite intuitively.</p>
<div class="gmail_quote">On Jan 17, 2012 7:51 AM, "Brian Jing" <<a href="mailto:brian.newsgroup@gmail.com">brian.newsgroup@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi guys,<br><br>I've played with the federation plugin a little. It seems that in order to send a message to a queue on the downstream server, the same queue has to be declared on the upstream server for federation to work?<br>
<br>For example:<br>__________________<br>| |<br>| Downstream server | Exchange-D <------ q1<br>|_________________|<br> ^<br> |<br> |<br>__________________<br>
| |<br>
| Upstream server | Exchange-U <------ q1<br>
|_________________|<br> <br>_______ <br>| | <br>
| Client |<br>
|_______|<br><br>If I want to send messages from client through Upstream server to Downstream server, The messages can only get through when I declare a "q1" on Upstream server, bind that queue to Exchange-U with a routing key, then send the message to Exchange-U using that routing key. Not sure if this is how it's supposed to work. <br>
<br>Is it possible not to declare q1 on Upstream server and make federation work? My problem is that I have multiple customers listening to their own queues on Downstream server, and customers can be removed or added at any time. Say if X just connected to Downstream server, and I want to send messages to it. How would I be able to send messages to X given that I don't have a queue on Upstream server that corresponds to it? Though I already know X is in the customer list, when my clients start and initialise, I don't think it's a good idea to just create queues for all customers on the list, which I think would consume system resources unnecessarily.<br>
<br>Hopefully it all makes sense to you guys. Let me know if it's unclear.<br><br>The following is my federation config.<br><span style="color:rgb(0,102,0)">{rabbitmq_federation,</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> [ {exchanges, [[{exchange, "Exchange-D"},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {virtual_host, "/"},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {type, "topic"},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {durable, true},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {auto_delete, false},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {internal, false},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {upstream_set, "upsteam-servers"}]</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> ]},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {upstream_sets, [{"upsteam-servers", [[{connection, "192.168.0.21"},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {exchange, "Exchange-U"},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {max_hops, 2}</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> ]}</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> ]},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {connections, [{"Upstream-server", [{host, "upstream"},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {protocol, "amqps"},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {port, 5671},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {ssl_options,</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> [{cacertfile, "/etc/rabbitmq/certs/testca/cacert.pem"},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {certfile, "/etc/rabbitmq/certs/client/cert.pem"},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {keyfile, "/etc/rabbitmq/certs/client/key.pem"},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> {verify, verify_peer},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {fail_if_no_peer_cert, false}</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> ]}</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> ]}</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> ]},</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> {local_username, "guest"},</span><br style="color:rgb(0,102,0)">
<span style="color:rgb(0,102,0)"> ]</span><br style="color:rgb(0,102,0)"><span style="color:rgb(0,102,0)"> }</span><br><br>Thanks,<br><br>Brian<br>
<br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div>