I am using the AMQP pecl extension (http://pecl.php.net/package/amqp) for connecting to rabbitMQ from my PHP app. I have the following scripts:<br><br>producer.php:<br><br>$cnn = new AMQPConnection();<br>$cnn-&gt;connect();<br><br>$ch = new AMQPChannel($cnn);<br><br>$ex = new AMQPExchange($ch);<br>$ex-&gt;setName('ex2');<br>$ex-&gt;setType(AMQP_EX_TYPE_FANOUT);<br>$ex-&gt;declare();<br><br>$q = new AMQPQueue($ch);<br>$q-&gt;setName('test1243');<br>$q-&gt;setFlags(AMQP_DURABLE);<br>$q-&gt;declare();<br>$q-&gt;bind('ex2', 'routing.key');<br><br>for ($i = 0; $i &lt; 100; $i++) {<br>&nbsp;&nbsp;&nbsp; $ex-&gt;publish('msg ' . ($i +1), 'routing.key');<br>}<br><br>The producer publishes 100 messages. <br><br>Then I have a consumer.php:<br><br>$cnn = new AMQPConnection();<br>$cnn-&gt;connect();<br><br>// Create a channel<br>$ch = new AMQPChannel($cnn);<br><br>$q = new AMQPQueue($ch);<br>$q-&gt;setName('test1243');<br>$q-&gt;setFlags(AMQP_DURABLE);<br>$q-&gt;declare();<br>$q-&gt;bind('ex2', 'routing.key');<br><br>$ex = new AMQPExchange($ch);<br>$ex-&gt;setName('ex2');<br>$ex-&gt;setType(AMQP_EX_TYPE_FANOUT);<br>$ex-&gt;declare();<br><br>function processMessage($envelope, $queue) {<br>&nbsp;&nbsp;&nbsp; echo "Message $i: " . $envelope-&gt;getBody() . "\n";<br>&nbsp;&nbsp;&nbsp; $queue-&gt;ack($envelope-&gt;getDeliveryTag());<br>}<br><br>$q-&gt;consume("processMessage");<br><br>The consumer just writes the messages to stdout and ackĀ“s them. <br><br>I used the exchange type fanout, because I want each message from the producer delivered to each consumer. <br><br>But if I start 2 consumers the output looks like this:<br><br>output consumer1:<br>Message : msg 1<br>Message : msg 3<br>Message : msg 5<br>...<br><br>output consumer2:<br>Message : msg 2<br>Message : msg 4<br>Message : msg 6<br>Message : msg 8<br>...<br><br>It looks like the messages are distributed using round robin or the like, consumer 1 gets message 1, consumer 2 gets message 2 etc. <br><br>Is fanout the wrong exchange for this? Or is something wrong in my setup code?<br>Defining the routing key is probably usesless as this is ignored in fanout anway, right?<br><br>