Composer
composer create-project --prefer-dist tumi/workerman-thrift-resque:dev-master
普通作业
namespace App\Resque\Job;
class Demo
{
public function perform()
{
\Workerman\Worker::log($this->args['str']);
}
}
启动
php start.php start -d
重启
php start.php restart
平滑重启
php start.php reload
查看状态
php start.php status
停止
php start.php stop
添加作业
Resque::setBackend('127.0.0.1:6379');
$args = ['str' => 'This is a test!'];
$id = Resque::enqueue('default', 'Demo', $args);
删除作业
Resque::setBackend('127.0.0.1:6379');
Resque::dequeue('default', ['Demo']);
Resque::dequeue('default', ['Demo' => $id]);
Resque::dequeue('default', ['Demo' => ['str' => 'This is a test!']]);
Resque::dequeue('default', ['Demo1', 'Demo2']);
查询状态
Resque::setBackend('127.0.0.1:6379');
// Resque::enqueue('default', 'Demo', $args, true); 添加作业时
$id = '';
$status = new Resque_Job_Status($id);
$status->get();
通过Thrift RPC(参考client.php)