Sorry for me writing here: I can't figure out how to use mailing list for replies =/<div><br></div><div><br></div><div>My Client.php declares callback queue php-object as following:</div><div><pre class="lang-php prettyprint" style="margin-bottom: 10px; padding: 5px; font-size: 14px; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow: auto; width: auto; max-height: 600px; color: rgb(0, 0, 0); line-height: 18px; text-align: left; "><code style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; "><span class="pln" style="background-color: transparent; ">$callbackQueue </span><span class="pun" style="background-color: transparent; ">=</span><span class="pln" style="background-color: transparent; "> </span><span class="kwd" style="background-color: transparent; color: rgb(0, 0, 139); ">new</span><span class="pln" style="background-color: transparent; "> </span><span class="pun" style="background-color: transparent; ">\</span><span class="typ" style="background-color: transparent; color: rgb(43, 145, 175); ">AMQPQueue</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; ">$channel</span><span class="pun" style="background-color: transparent; ">);</span><span class="pln" style="background-color: transparent; "><br>$callbackQueue</span><span class="pun" style="background-color: transparent; ">-&gt;</span><span class="pln" style="background-color: transparent; ">setFlags</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; ">AMQP_EXCLUSIVE</span><span class="pun" style="background-color: transparent; ">);</span><span class="pln" style="background-color: transparent; "> </span><span class="com" style="background-color: transparent; color: gray; ">// set EXCLUSIVE flag</span><span class="pln" style="background-color: transparent; "><br>$callbackQueue</span><span class="pun" style="background-color: transparent; ">-&gt;</span><span class="pln" style="background-color: transparent; ">declare</span><span class="pun" style="background-color: transparent; ">();</span></code></pre><div>After that I pass it's name at an envelope to server like this ($callbackQueue-&gt;getName at 'reply_to')</div><div><pre class="lang-php prettyprint" style="margin-bottom: 10px; padding: 5px; font-size: 14px; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow: auto; width: auto; max-height: 600px; color: rgb(0, 0, 0); line-height: 18px; text-align: left; "><code style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; "><span class="pln" style="background-color: transparent; ">$exchange</span><span class="pun" style="background-color: transparent; ">-&gt;</span><span class="pln" style="background-color: transparent; ">publish</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; json_encode</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; ">array</span><span class="pun" style="background-color: transparent; ">(</span><span class="str" style="background-color: transparent; color: rgb(128, 0, 0); ">'process me!'</span><span class="pun" style="background-color: transparent; ">)),</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; </span><span class="str" style="background-color: transparent; color: rgb(128, 0, 0); ">'temp_action'</span><span class="pun" style="background-color: transparent; ">,</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; AMQP_MANDATORY</span><span class="pun" style="background-color: transparent; ">,</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; array</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="str" style="background-color: transparent; color: rgb(128, 0, 0); ">'reply_to'</span><span class="pln" style="background-color: transparent; "> </span><span class="pun" style="background-color: transparent; ">=&gt;</span><span class="pln" style="background-color: transparent; "> $callbackQueue</span><span class="pun" style="background-color: transparent; ">-&gt;</span><span class="pln" style="background-color: transparent; ">getName</span><span class="pun" style="background-color: transparent; ">(),</span><span class="pln" style="background-color: transparent; "> </span><span class="com" style="background-color: transparent; color: gray; ">// pass callback queue name</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="str" style="background-color: transparent; color: rgb(128, 0, 0); ">'correlation_id'</span><span class="pln" style="background-color: transparent; "> </span><span class="pun" style="background-color: transparent; ">=&gt;</span><span class="pln" style="background-color: transparent; "> $correlationId<br>&nbsp; &nbsp; </span><span class="pun" style="background-color: transparent; ">)</span><span class="pln" style="background-color: transparent; "><br></span><span class="pun" style="background-color: transparent; ">);</span></code></pre></div><div><br></div><div>And my Server.php creates a new Queue php-object (in an anonymous function that handles consuming) as following:<br></div><div><pre class="lang-php prettyprint" style="margin-bottom: 10px; padding: 5px; font-size: 14px; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow: auto; width: auto; max-height: 600px; color: rgb(0, 0, 0); line-height: 18px; text-align: left; "><code style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; "><span class="pln" style="background-color: transparent; ">&nbsp; &nbsp; $callbackQueue </span><span class="pun" style="background-color: transparent; ">=</span><span class="pln" style="background-color: transparent; "> </span><span class="kwd" style="background-color: transparent; color: rgb(0, 0, 139); ">new</span><span class="pln" style="background-color: transparent; "> </span><span class="pun" style="background-color: transparent; ">\</span><span class="typ" style="background-color: transparent; color: rgb(43, 145, 175); ">AMQPQueue</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; ">$channel</span><span class="pun" style="background-color: transparent; ">);</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; $callbackQueue</span><span class="pun" style="background-color: transparent; ">-&gt;</span><span class="pln" style="background-color: transparent; ">setName</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; ">$envelope</span><span class="pun" style="background-color: transparent; ">-&gt;</span><span class="pln" style="background-color: transparent; ">getReplyTo</span><span class="pun" style="background-color: transparent; ">());</span><span class="pln" style="background-color: transparent; "><br>&nbsp; &nbsp; $callbackQueue</span><span class="pun" style="background-color: transparent; ">-&gt;</span><span class="pln" style="background-color: transparent; ">setFlags</span><span class="pun" style="background-color: transparent; ">(</span><span class="pln" style="background-color: transparent; ">AMQP_EXCLUSIVE</span><span class="pun" style="background-color: transparent; ">);</span><span class="pln" style="background-color: transparent; "> </span><span class="com" style="background-color: transparent; color: gray; ">// set EXCLUSIVE flag</span></code></pre></div><div>Right after that moment I'm trying to bind newly created $callbackQueue object to an exchange - and this causes blocking issue.</div><div><br></div><div><br></div><div>I'm not sure which exact options are different (exclusive looks for me to be the only flag I set in both cases).&nbsp;</div><div>Setting name in Server.php is necessary and name is taken from envelope's 'reply_to' setting.&nbsp;</div><div><br></div><div>As far as I can see no extra declaration of callback queue is happening on a Server.php side. (Although tempQueue Server consumes messages from is extra declared, but this is made for server to be able to listen that queue even when before any client exists)</div><br>On Thursday, June 21, 2012 12:33:42 PM UTC+4, Alvaro Videla wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">While not using the same library here you have the official tutorials ported to PHP<div><br></div><div><a href="https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/php" target="_blank">https://github.com/rabbitmq/<wbr>rabbitmq-tutorials/tree/<wbr>master/php</a></div>
<div><br></div><div>The problem in your code is that you declare queues with different options.&nbsp;</div><div><br></div><div>So as one reply say, if you declare queue A as durable, then every other declaration of that queue must be durable. The same for the exclusive flag.</div>
<div><br></div><div>Also you don't need to redeclare a queue to publish messages to it. As an RPC server you assume that the address sent in the 'reply_to' property is already present. I think is the responsibility of the RpcClient to make sure the queue where it is waiting for replies exists already.</div>
<div><br></div><div>Regards,</div><div><br></div><div>Alvaro</div><div><br></div><div>And you can indeed do RPC over RabbitMQ by using different connections.<br><br><div class="gmail_quote">On Wed, Jun 20, 2012 at 8:03 PM, Denis&nbsp;wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Hello guys.</span><div><br></div><div>I'm trying to build RPC using PHP, here is my description of problem:</div>
<div><a href="http://stackoverflow.com/questions/11104004/rabbitmq-rpc-exclusive-queues-locking-php" style="color:rgb(17,85,204)" target="_blank">http://stackoverflow.com/<u></u>quest<wbr>ions/11104004/rabbitmq-<u></u>rpc-<wbr>exclusive-queues-locking-<u></u>php</a></div>
<div><br></div><div>The main issue I suspect is that Client.php and Server.php try to connect to RabbitMQ server using different connections, which leads to inability of using EXCLUSIVE queue (that is declared in CLient.php) from Server.php</div>
<div><br></div><div>Can u give me a way I can dig to? I'm out of ideas ...</div><br>______________________________<wbr>_________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.<wbr>rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/<wbr>cgi-bin/mailman/listinfo/<wbr>rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>
</blockquote></div>