Code Monkey home page Code Monkey logo

Comments (7)

chrisboulton avatar chrisboulton commented on June 19, 2024

Hey Jacob,

The answer to the first question is a yes. I've tried to keep everything exactly the same as the Ruby version, in terms of job storage, and the actual API/code.

The second should also be a yes, but I haven't had the opportunity to test that. There's no reason why it shouldn't work - you just need to make sure the job class names you pass along exist as classes in your Ruby app. This should also work in the reverse - from Ruby you should be able to have a job queued for execution on a PHP worker. Of course, you just need to make sure the right worker is picking up the right jobs.

from php-resque.

jacobSingh avatar jacobSingh commented on June 19, 2024

Thanks Chris for the timely response!

I'll let you know how our implementation goes if I can sell it internally.

Best,
Jacob

On Sun, Apr 3, 2011 at 1:30 PM, chrisboulton <
[email protected]>wrote:

Hey Jacob,

The answer to the first question is a yes. I've tried to keep everything
exactly the same as the Ruby version, in terms of job storage, and the
actual API/code.

The second should also be a yes, but I haven't had the opportunity to test
that. There's no reason why it shouldn't work - you just need to make sure
the job class names you pass along exist as classes in your Ruby app. This
should also work in the reverse - from Ruby you should be able to have a job
queued for execution on a PHP worker. Of course, you just need to make sure
the right worker is picking up the right jobs.

Reply to this email directly or view it on GitHub:
#16 (comment)

+1 512-522-6281
twitter: @jacobSingh ( http://twitter.com/#!/JacobSingh )
web: http://www.jacobsingh.name
Skype: pajamadesign
gTalk: [email protected]

from php-resque.

chrisboulton avatar chrisboulton commented on June 19, 2024

No worries.

Going to close this out - but definitely reopen it if something's not working as I explained above.

from php-resque.

asifmom avatar asifmom commented on June 19, 2024

@jacobSingh wondering whether you were able to do it successfully. i.e. create jobs in PHP which are then executed by Ruby workers?

from php-resque.

danhunsaker avatar danhunsaker commented on June 19, 2024

Interested to find out as well, but I'm pretty sure Chris has been using it this way successfully for a while... As he pointed out, so long as each only collects jobs it has classes for (separate queues, name spacing, and a few other tricks can be used to ensure this), it should work just fine.

Of course, your version of Ruby Resque might affect this. PHP-Resque hasn't kept pace with the Ruby version's gradual evolution, so you may need to use a version from roughly three years ago or so. I'd roll it back until it works...

But yeah, definitely interested in the response here.

from php-resque.

chrisboulton avatar chrisboulton commented on June 19, 2024

Yep, this is something we're doing here internally without issue and have been for a while. We have both sides pickup and schedule jobs for each other. Each set of workers checks a different set of queues.

from php-resque.

rex avatar rex commented on June 19, 2024

I apologize for the bump on such an old ticket, but it's near the top of Google results and I wanted to leave this here for other people interested in queueing jobs with PHP to be processed by an existing Ruby Resque server.

THIS DOES WORK. EASILY.

PHP

function queue($job_class = 'Workers::YourWorkerName', $job_data = []) {
  Resque::setBackend('localhost:6379');
  Resque::enqueue('queue_name_here', $job_class, $job_data);
}

Ruby

# lib/workers/your_worker_name.rb
module Workers
  class YourWorkerName
    @queue = 'queue_name_here'

    def self.perform(opts)
        puts opts.inspect
    end
  end
end

Then, it's as simple as:

PHP

queue('Workers::YourWorkerName', [
  'name' => 'Pierce',
  'username' => 'rex',
  'things' => [
    'thing1',
    'thing2',
    'anotherThing'
  ]
]);

from php-resque.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.