2017 © Pedro Peláez
 

library queueable

Framework Agnostic Queue System

image

dilab/queueable

Framework Agnostic Queue System

  • Tuesday, July 4, 2017
  • by xuding
  • Repository
  • 0 Watchers
  • 2 Stars
  • 2,330 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 16 Versions
  • 3 % Grown

The README.md

Queueable: Framework Agnostic Queue/Worker System

Install

composer require dilab/queueable

Usage

Job & Queue

  • Create a Job

class SendEmailJob implements JobContract { public function handle(Payload $payload) { return 'Sending an email to user ' . $payload->get('name'); } }
  • Create a Queue
$driver = new InMemoryDriver();

$queue = new Queue('email', $driver);
  • Enqueue a job
$queue->push(
    new SendEmailJob(),
    new Payload(['name' => 'Xu'])
);

Worker

  • Create a Worker instance
$worker = new Worker($queue);
  • Put worker to work
$worker->work($maxTries = 5, $sleepSecs = 5);
$worker->setLogger($psr3Logger);

Callbacks

  • beforeFetchJob: It is called before trying to fetch a job from the queue
$worker->attach('heartbeat', function () use ($queueName) {
    // do something useful
});
  • beforeCompleteJob: It is called before a job is completed
$worker->attach('beforeCompleteJob', function () {
    // do something useful
});
  • afterCompleteJob: It is called after a job is completed
$worker->attach('afterCompleteJob', function () {
    // do something useful
});
  • onError: It is called whenever it is failed to process a job
$worker->attach('onError', function ($failedJob, $message, $trace) {
    // send an email
});

Current Drivers:

  • [x] AWS SQS

Notes

Some general notes when developing this package + Driver works with message(raw data, mostly in array format) + Queue translates message to Job + Job works with message + Worker works with Job & Queue objects, (*1)

The Versions

04/07 2017

0.2.4

0.2.4.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

04/07 2017

dev-master

9999999-dev

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

26/02 2017

0.2.3

0.2.3.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

13/01 2017

0.2.2

0.2.2.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

13/01 2017

0.2.1

0.2.1.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

23/12 2016

0.2.0

0.2.0.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

23/12 2016

0.1.9

0.1.9.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

18/12 2016

0.1.8

0.1.8.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

15/12 2016

0.1.7

0.1.7.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

01/12 2016

0.1.6

0.1.6.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

11/11 2016

0.1.5

0.1.5.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

11/11 2016

0.1.4

0.1.4.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

10/11 2016

0.1.3

0.1.3.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

10/11 2016

0.1.2

0.1.2.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

10/11 2016

0.1.1

0.1.1.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires

10/11 2016

0.1

0.1.0.0

Framework Agnostic Queue System

  Sources   Download

MIT

The Requires

 

The Development Requires