[rabbitmq-discuss] About PHP PECL extension

Christian Legnitto clegnitto at mozilla.com
Thu Oct 14 06:41:11 BST 2010


Ok, I wasn't interested in this before but now I am :-). I plan to write a mediawiki extension that publishes messages into rabbit and this is a rather crucial piece.

Let me know what help I can give.

I would also take a look at carrot (python) as it has an API that is fairly easy to use and can be generalized for other protocols (like stomp). Every time I do something amqp specific it seems like the next question is if it will support stomp. That being said, I like what has been proposed so far.

Thanks,
Christian

On Oct 12, 2010, at 9:09 PM, Brad Rodriguez wrote:

> I generally like the API of the Java client, although we would obviously not want the php client to be quite as verbose.
> 
> I'm on board with disabling auto-connect in favor of explicitly controlling when we connect and disconnect. Specifically, having disconnect and reconnect methods will be especially useful.
> 
> I like the following API:
> 
> $connection = new AMQPConnection($params);
> $connection->connect();
> 
> $exchangeList = $connection->listExchanges();
> $exchange = $connection->exchangeDeclare('my_exchange', AMQP_EX_TYPE_TOPIC, $flags);
> 
> $queueList = $exchange->listQueues();
> $queue = $connection->queueDeclare('my_queue', $flags);
> 
> 
> $queue->bind($exchange, $routingKey);
> $queue->unbind($exchange, $routingKey);
> 
> $exchange->publish($message, $routingKey);
> 
> $connection->disconnect();
> 
> -Brad
> 
> 
> On Oct 8, 2010, at 6:54 PM, Pieter de Zwart wrote:
> 
>> Happy too. Though I’m gonna point at you if we start annoying people =)
>> 
>> I looked through the Java client, which would seem to be the most mature and well built client to date. The major difference between the PHP extension (hereby PHPE) and the Java client (hereby JC... get it?) is that the JC allows the creation of multiple channels, and the ability to act within a channel. PHPE instead uses one channel for everything (channel 1.)
>> As far as objects go, since I want PHPE to be OO, the current layout seems to make sense to me, with AMQPConnection, AMQPExchange and AMQPQueue. From there, the methods I think need to be cleaned up:
>> AMQPConnection should continue to allow the $params = array() setup, whereby a user can create and set username, password, host, port and vhost, like so:
>> 
>> $cnn = new AMQPConnection(array(‘login’ => ‘guest’, ‘password’ => ‘’, ‘host’ => ‘localhost’)); 
>> 
>> However, I want to remove the auto-connect portion of the constructor, so users have to call:
>> 
>> $cnn->connect();
>> 
>> That way, we can also add the following method: setLogin, setPassword, setPort, setHost, setVHost. I also want to add the following action methods: reconnect, disconnect.
>> 
>> The connection object should in turn give access to exchanges and queues, but how I am not yet sure, and I would love feedback from everyone on this. I like JC’s approach of using AMQPConnection->queueDeclare and AMQPConnectio->exchangeDeclare which would return instances of AMQPQueue and AMQPExchange respectively. I guess those methods would also accept an additional bit mask for options, and if the queue/exchange already exists, the new bit mask values would be applied...
>> 
>> I am tired, so I will stop here and look for others to poke holes in my theory. Feedback from JC users in particular would be much appreciated in terms of likes and dislikes of their client.
>> 
>> Pieter 
>> 
>> 
>> 
>> On 10/8/10 12:41 AM, "Pedram Nimreezi" <mc at majorcomputing.com> wrote:
>> 
>>> Keep it on the air ways...  if you would...
>>> 
>>> 
>>> 
>>> On Fri, Oct 8, 2010 at 3:11 AM, Alvaro Videla <videlalvaro at gmail.com> wrote:
>>>> Well,
>>>> 
>>>> I said where is the place to contribute, not that I had something to contribute right now…
>>>> 
>>>> But we might start using this extension in prod and I remember last time I checked the API there was some stuff I'd like it to be "different"
>>>> 
>>>> Regards,
>>>> 
>>>> Alvaro
>>>> 
>>>> On Oct 8, 2010, at 3:09 PM, Pieter de Zwart wrote:
>>>> 
>>>> > Oh thank you deity of your choice for answering me. I need help.
>>>> > Lets take this off list so we don't pollute the airways.
>>>> > Pieter
>>>> >
>>>> >
>>>> > On 10/8/10 12:06 AM, "Alvaro Videla" <videlalvaro at gmail.com> wrote:
>>>> >
>>>> >> Hi Pieter,
>>>> >>
>>>> >> My question is more where is the source code that we can contribute back. I
>>>> >> know about the PECL stuff :)
>>>> >>
>>>> >> Regards,
>>>> >>
>>>> >> Alvaro
>>>> >>
>>>> >>
>>>> >> On Oct 8, 2010, at 3:05 PM, Pieter de Zwart wrote:
>>>> >>
>>>> >>> Excellent question. The source code for this:
>>>> >>> http://php.net/manual/en/book.amqp.php
>>>> >>> is available here:
>>>> >>> http://pecl.php.net/package/amqp
>>>> >>>
>>>> >>> I am reworking it right now to work with Rabbit 2.0.* and 2.1.*. The one
>>>> >>> listed works with 1.7.*.
>>>> >>>
>>>> >>> Pieter
>>>> >>>
>>>> >>>
>>>> >>> On 10/7/10 11:45 PM, "Alvaro Videla" <videlalvaro at gmail.com> wrote:
>>>> >>>
>>>> >>>> I think is php-rabbit
>>>> >>>>
>>>> >>>> Thanks!
>>>> >>>>
>>>> >>>> On Oct 8, 2010, at 2:41 PM, Alexis Richardson wrote:
>>>> >>>>
>>>> >>>>> Could it be one of these?
>>>> >>>>>
>>>> >>>>> http://www.delicious.com/alexisrichardson/rabbitmq+client+php
>>>> >>>>>
>>>> >>>>>
>>>> >>>>>
>>>> >>>>> On Fri, Oct 8, 2010 at 7:04 AM, Alvaro Videla <videlalvaro at gmail.com>
>>>> >>>>> wrote:
>>>> >>>>>> Hi,
>>>> >>>>>>
>>>> >>>>>> I would like to know where's the code for the PHP extension that appears
>>>> >>>>>> on
>>>> >>>>>> the PHP website.
>>>> >>>>>>
>>>> >>>>>> Regards,
>>>> >>>>>>
>>>> >>>>>> Alvaro
>>>> >>>>>> _______________________________________________
>>>> >>>>>> rabbitmq-discuss mailing list
>>>> >>>>>> rabbitmq-discuss at lists.rabbitmq.com
>>>> >>>>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>> >>>>>>
>>>> >>>>
>>>> >>>> _______________________________________________
>>>> >>>> rabbitmq-discuss mailing list
>>>> >>>> rabbitmq-discuss at lists.rabbitmq.com
>>>> >>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>> >>>
>>>> >>
>>>> >
>>>> 
>>>> _______________________________________________
>>>> rabbitmq-discuss mailing list
>>>> rabbitmq-discuss at lists.rabbitmq.com
>>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>> 
>>> 
>> 
>> 
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> 
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101013/58aed3c9/attachment.htm>


More information about the rabbitmq-discuss mailing list