Drew
Drew

Reputation: 15408

Starting a Resque Job handled by another Rails Server

I have a Rails with a worker (Worker App) that I want another Rails app to invoke (Requester App). One option is to create a controller action on the Worker App that the Requester App can post to.

Is there a way to directly add the job to the Worker App's Redis server? I know I can just push the value into the redis server, but I'm not sure what format it should be in and I haven't found the documentation for it. Is this even possible, or is Resque doing a bunch of stuff I don't know about?

Upvotes: 1

Views: 226

Answers (1)

Leo Correa
Leo Correa

Reputation: 19789

Looking at the Resque code you can push a job into the queue by doing the following:

Resque.push('my_queue', 'class' => 'MyQueue', 'args' => [ 123, 'bar'])

That will push a job into the my_queue queue for the MyQueue job to perform it.

Here's the piece of code of interest

https://github.com/resque/resque/blob/master/lib/resque.rb#L142-L159

Upvotes: 1

Related Questions