<HTML>
<HEAD>
<TITLE>Re: [rabbitmq-discuss] PHP Client libraries</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hey guys,<BR>
<BR>
Please find an added patch to fix the queue->get method, which was returning the wrong associative array key for the message. This should be combined with the previous patch.<BR>
<BR>
Pieter<BR>
<BR>
<BR>
On 2/9/10 11:20 AM, "Pieter de Zwart" <<a href="pdezwart@rubiconproject.com">pdezwart@rubiconproject.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Good news. Seems like have a mostly working php-rabbit PHP module. Attached is the patch to make it work with RabbitMQ 1.7*. For those of you less familiar with building/managing PHP clients, perform the following commands:<BR>
<BR>
$ wget <a href="http://php-rabbit.googlecode.com/files/php-rabbit.zip">http://php-rabbit.googlecode.com/files/php-rabbit.zip</a><BR>
$ unzip php-rabbit.zip<BR>
$ cd php-rabbit<BR>
$ phpize<BR>
$ php –I | head<BR>
Copy the current ./configure statement and execute it<BR>
$ patch rabbit.c php-rabbit.patch<BR>
$ make && sudo make install<BR>
$ echo “extension = /path/to/lib/folder/rabbit.so” > /etc/php.d/rabbit.ini<BR>
$ php –m | grep rabbit<BR>
The last command should display “rabbit”, meaning that the library was recognized.<BR>
<BR>
I have also included a very basic test script that you can use to validate that things are working. I tweaked it post test, so there might be some typos in it.<BR>
<BR>
I had to run:<BR>
$ sudo /sbin/ldconfig<BR>
to get the librabbitmq.so library to be pulled in, so please keep that in mind.<BR>
<BR>
If you have any questions, please let me know. There are still a few bugs, two of which are:<BR>
</SPAN></FONT><OL><LI><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>During connection, if you specify additional parameters like AMQP_DURABLE, the exchange type length is seen as 0, even if you specify one, and it therefore defaults all new exchange types to ‘direct’. We use topic exchanges here, so I tweaked it to default to ‘topic’ until that gets fixed.
</SPAN></FONT><LI><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I managed to make it segfault by passing in a weird exchange name. I will put together a demonstration script asap.<BR>
</SPAN></FONT></OL><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
This patch fixes:<BR>
</SPAN></FONT><OL><LI><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Names and typos. Everything is AMQP (not AQPM, etc..) and the connection class is AMQPConnection, not AQMPConnect.
</SPAN></FONT><LI><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>The library is now defined correctly, and should therefore load without tweaking the configure or doing any other wonky things.
</SPAN></FONT><LI><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>All of the METHOD_OK parameters are no longer dereferenced improperly
</SPAN></FONT><LI><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I added the heartbeat parameter to provide the valid number of parameters to amqp_login<BR>
</SPAN></FONT></OL><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
I am now going to go load test this thing to see if I can make it crash.<BR>
<BR>
Pieter<BR>
<BR>
<BR>
On 2/9/10 8:47 AM, "Pieter de Zwart" <<a href="pdezwart@rubiconproject.com">pdezwart@rubiconproject.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hey guys,<BR>
<BR>
Just FYI, I have a mostly working php-rabbit patch. Using the demo script I can declare, bind, publish and consume. I ran into a segfault when I tried to incorporate it into our framework, so there is still some debugging to do there.<BR>
I will submit a patch to everyone later today, with the understanding that I make no guarantees as to whether it is production ready.<BR>
<BR>
Pieter<BR>
<BR>
<BR>
On 2/9/10 3:00 AM, "Alexandre Kalendarev" <<a href="akalend@mail.ru">akalend@mail.ru</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi Dieter,<BR>
<BR>
> thank you for your reply. Am I right, the module does not support<BR>
> consuming messages?<BR>
<BR>
The module is support Consume and Get methods. But Consume<BR>
methods is sync and GET is async.<BR>
<BR>
If You use the the consume in the WEB pages, the HTTP protocol is async and You can't wait if you have not commet technology.<BR>
My recomendation is use the series of GET method:<BR>
<BR>
// get queue items<BR>
$queue = new AMQPQueue(APMQConection(), 'my_queue');<BR>
$i=0;<BR>
$res = true;<BR>
while ($res = $queue->get() !== false ){<BR>
$i++;<BR>
echo "$i : {$res['msg']}<br>\n";<BR>
}<BR>
<BR>
But, You can use the Consume, You must the read queue lenght and make Consume of len messages.<BR>
It is guarantie of absent waiting new messages.<BR>
<BR>
<BR>
// consume<BR>
$i=0;<BR>
$queue = new AMQPQueue(APMQConection());<BR>
<BR>
$n = $queue->declare('my_queue'); // we get the lenght of queue<BR>
<BR>
$queueMessages = $queue->consume( $n ); // we reading $n messages, all queue.<BR>
foreach($queueMessages as $item){<BR>
$i++;<BR>
echo "$i.$item";<BR>
}<BR>
<BR>
If $n less lenght of queue, the all nonreaded messages will be gone.<BR>
<BR>
The Consume method is faster.<BR>
<BR>
>Or Am i mixing up the Modules?<BR>
the module php-amqp <a href="http://code.google.com/p/php-amqp/">http://code.google.com/p/php-amqp/</a> don't support consume, bind and queue. It is only publish.<BR>
<BR>
If You have any questions send me, I will very happeness ask You. Sorry for my English.<BR>
<BR>
Alexandre<BR>
<BR>
_______________________________________________<BR>
rabbitmq-discuss mailing list<BR>
<a href="rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><BR>
<a href="http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
-- <BR>
</SPAN></FONT><FONT COLOR="#343434"><FONT SIZE="4"><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:14pt'>the rubicon project<BR>
</SPAN></FONT></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><FONT COLOR="#BA0022"><FONT SIZE="1"><SPAN STYLE='font-size:9pt'><BR>
</SPAN><SPAN STYLE='font-size:7pt'>PIETER DE ZWART </SPAN></FONT></FONT><FONT SIZE="1"><SPAN STYLE='font-size:7pt'><FONT COLOR="#404040">| INTERFACES ENGINEER<BR>
</FONT><FONT COLOR="#AC0021"><BR>
</FONT><FONT COLOR="#BB001E">••• P 310 207 0272 | x224<BR>
••• F 323 466 7119<BR>
</FONT><BR>
<FONT COLOR="#3C3C3C"><BR>
1925 S. BUNDY DRIVE<BR>
LOS ANGELES, CALIFORNIA 90025<BR>
</FONT><FONT COLOR="#B60F1D"><BR>
</FONT><FONT COLOR="#0000FF">WWW.RUBICONPROJECT.COM</FONT><FONT COLOR="#B60F1D"> <</FONT><FONT COLOR="#0000FF"><U><a href="http://">http://</a>www.rubiconproject.com/</U></FONT><FONT COLOR="#B60F1D">> <BR>
</FONT></SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT COLOR="#2F2F2F"><FONT SIZE="4"><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:13pt'><IMG src="cid:3348566770_1062988" ><BR>
</SPAN></FONT></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><FONT COLOR="#787878"><FONT SIZE="1"><SPAN STYLE='font-size:7pt'>“COMPANY OF THE YEAR” ALWAYSON ONMEDIA 2009<BR>
#24 ON FAST COMPANY FAST 50 READER FAVORITES<BR>
2008 ALWAYSON 250 GLOBAL WINNER<BR>
2008 ALWAYSON ONMEDIA 100 WINNER<BR>
TWIISTUP3 BEST IN SHOW<BR>
</SPAN></FONT></FONT><FONT SIZE="1"><SPAN STYLE='font-size:7pt'><FONT COLOR="#777777">PRICEWATERHOUSECOOPERS – ENTRETECH BEST STARTUP<BR>
</FONT><FONT COLOR="#787878">AMERICAN BUSINESS AWARDS - STEVIES ‘08 FINALIST BEST NEW COMPANY<BR>
</FONT><FONT COLOR="#777777">AMERICAN BUSINESS AWARDS - STEVIES ‘08 FINALIST MOST INNOVATIVE COMPANY<BR>
AMERICAN BUSINESS AWARDS - STEVIES ‘08 FINALIST NEW PRODUCT OR SERVICE - SERVICES<BR>
<BR>
</FONT></SPAN></FONT></FONT><FONT COLOR="#198000"><FONT SIZE="6"><FONT FACE="Webdings"><SPAN STYLE='font-size:24pt'>P</SPAN></FONT></FONT><FONT SIZE="1"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:7pt'> </SPAN></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:8pt'>Please consider the environment before printing this e-mail</SPAN></FONT></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>