pushing queue items from php

56 views
Skip to first unread message

dvirsky

unread,
Dec 23, 2010, 4:50:01 AM12/23/10
to HotQueue Users
Hi,
I'm doing a mixed php and python project using redis, and would like
to use hotqueue.
What would it take to write a php class that will be able to push jobs
to the queue? how do you manage it internall against redis?

Thanks,
Dvir

richardhenry

unread,
Dec 25, 2010, 10:31:49 AM12/25/10
to HotQueue Users
The current version of HotQueue wouldn't support that I'm afraid, at
least not easily: it expects the queue to only contain serialized
Python objects. This will likely change in the future.

Richard

Dvir Volk

unread,
Dec 25, 2010, 11:16:34 AM12/25/10
to hotqueu...@googlegroups.com
how about changing the serialization to JSON or something cross language?
or even directly to redis as HASHes?
suppose I were to do that, how are objects saved into redis?
I'd be glad to contribute my php code back to the project of course.

richardhenry

unread,
Dec 25, 2010, 4:08:30 PM12/25/10
to HotQueue Users
I plan to make the serialization arbitrary, so that you can pass in
any serialization class that has the loads and dumps methods. This
would allow you to use JSON, or one of the JSON object pickling
libraries out there, or even to write your own serializer.

I'm not interested in adding support for other languages directly to
the HotQueue project yet, mostly because HotQueue is still in it's
infancy. However I'd certainly encourage you to launch your own
"HotQueue compatible" library in PHP.

You can see how HotQueue works internally here, take a look at the put
and get methods:

https://github.com/richardhenry/hotqueue/blob/master/hotqueue.py

The get method uses the LPOP or BLPOP command, and the put method uses
the RPUSH command.

Richard

richardhenry

unread,
Dec 25, 2010, 7:36:21 PM12/25/10
to HotQueue Users
I've added custom serialization, and written a brief tutorial on JSON
serialization:

http://richardhenry.github.com/hotqueue/tutorial.html#custom-serialization-json-etc

Hope this helps! You should be able to interchange data with PHP now.

Richard
Reply all
Reply to author
Forward
0 new messages