从 Web 应用程序在后台处理作业 [英] Jobs processing in background from web application

查看:50
本文介绍了从 Web 应用程序在后台处理作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Web 应用程序执行期间在后台安排和运行大量作业.
该网络应用程序建立在 Symfony 2 和 Doctrine 2 之上.

I want to schedule and run a lot of jobs in the background during a web application execution.
The web app is built on top of Symfony 2 and Doctrine 2.

我知道可以使用 Resque 或 Sidekiq 等库完成作业处理.但是,这些库和我的应用程序是用不同的语言编写的,所以我想知道如何运行用 Ruby 编写的 Sidekiq 作业,它应该与我用 PHP 编写的应用程序集成.

I know the job-processing can be done with libraries like Resque or Sidekiq. However, these libraries and my application are written in different languages, so I am wondering how I can run Sidekiq jobs written in Ruby which should integrate with my app written in PHP.

我问自己是否唯一的方法是重写大量代码以从 PHP 到 ruby​​ 查询数据库,以便能够在 Sidekiq/Resque 中执行作业.

What I'm asking myself is if the only way to do this is rewriting a large amount of code to query the database from PHP to ruby, to be able to execute the job in Sidekiq/Resque.

推荐答案

您是否看过Gearman?它让您可以像 Sidekiq 一样运行后台作业,但它与语言无关.例如,您可以将 PHP 用于所有事情,或者您可以使用 PHP 将作业排队并使用 Ruby 编写实际工作程序.

Have you taken a look at Gearman? It lets you run background jobs just like Sidekiq, but it's language agnostic. For example, you can use PHP for everything, or you can queue up jobs in PHP and have the actual workers written in Ruby.

这篇关于从 Web 应用程序在后台处理作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆