I want to queue Resque jobs from NodeJS. Monitoring Redis commands I see:
1346127083.495055 "sadd" "resque:w:tasks:queues" "facebook"
1346127083.495471 "rpush" "resque:w:tasks:queue:facebook" "{\"class\":\"Hello::FacebookFriends\",\"args\":[\"2342324\"]}"
Issuing those commands directly from Node seems to work. Are there any hidden bugs or things I'm not aware of here?
Update: My jobs are written in Ruby. While I love NodeJS and I'm way better in Javascript, I need tons of libraries that are still not available in a great condition in NPM, for example communicating with Twitter and Facebook (Twitter and Koala gems, There's nothing comparable for Node). So I want to start Ruby Jobs from my NodeJS service.
So far I'm using something that looks similar to this function from coffee-resque:
enqueue: (queue, func, args) ->
@redis.sadd @key('queues'), queue
@redis.rpush @key('queue', queue),
JSON.stringify class: func, args: args || []
Here:
job = JSON.stringify
class: 'Hello::FacebookFriends'
args: [user_id, fb.id]
@redis_client.multi()
.sadd('resque:w:tasks:queues', 'facebook')
.rpush('resque:w:tasks:queue:facebook', job)
.exec()
Why not set up a service that fires off the jobs? It would be an extra hop through the network, but the code should be simple enough(look at http://www.sinatrarb.com/ for example).