Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

99designs/sera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sera - A queueing library

Allows for long-running or asynchronous tasks to be written as Tasks and queued on a variety on queuing mechanism.

Currently supports Beanstalk and Amazon SQS.

Build Status

Installation

To add sera to a project, the easiest way is via composer:

{
    "require": {
        "99designs/sera": ">=1.0.0"
    }
}

Usage

<?php

// a simple task
class MyTask extends Sera_Task_Abstract
{
	public static function create($params)
	{
		return new self($params);
	}

	public function execute()
	{
    my_long_running_function($this->_data);
	}
}

// a queue that connects to beanstalkd
$queue = new Sera_Queue_BeanstalkQueue("127.0.0.1");
$queue->select('llama_tasks');

// enqueue the task
$queue->enqueue(MyTask::create('some data'));

// normally this would be in a seperate process
$worker = new Sera_Queue_QueueWorker($queue);
$worker->execute();

Copyright

Copyright (c) 2012 99designs See LICENSE for details.