2017 © Pedro Peláez
 

library hodor

PHP/rabbitmq-based job queue

image

lightster/hodor

PHP/rabbitmq-based job queue

  • Monday, July 30, 2018
  • by lightster
  • Repository
  • 3 Watchers
  • 3 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 14 Open issues
  • 14 Versions
  • 11 % Grown

The README.md

Hodor

Build Status Test Coverage Code Climate, (*1)

A worker queue that is evolving to a job queue, (*2)

Requirements

  • PHP >= 5.5.18
  • Composer
  • Supervisord
  • Postgres >= 9.3
  • RabbitMQ

Configuration

Install Hodor in your application via composer:, (*3)

composer require lightster/hodor:^0.2.0

Create a database on your Postgres server to use with your instance of Hodor:, (*4)

CREATE DATABASE hodor;

Copy the Hodor distribution config to wherever you keep your application configs:, (*5)

cp vendor/lightster/hodor/config/dist/config.dist.php config/hodor.php

Update the Postgres and RabbitMQ credentials in your config file., (*6)

Write your job runner bootstrap in the job_runner key of the config file. The method defined here will be called with the job name and job params any time a worker receives a job message. This method should not be more than a few lines—anything more than that should be offloaded into a bootstrap include script or class. An example job runner may look like:, (*7)

<?php
return [
    'job_runner' => function($name, $params) {
        $container = require_once __DIR__ . '/../bootstrap.php';
        $job_runner = $container['job_runner'];
        $job_runner->runJob($name, $params);
    },
];

Run the database migrations after your database credentials are setup in your config:, (*8)

bin/hodor.php database:migrate config/hodor.php

Then setup supervisord to manage your job queue processes:, (*9)

sudo php bin/hodor.php daemon:generate-config config/hodor.php
sudo service supervisord reload

Usage

use Hodor\JobQueue\JobQueue;

$job_queue = new JobQueue();
$job_queue->setConfigFile(__DIR__ . '/../../../config/hodor.php');
$job_queue->push(
    'Vendor\Project\SomeJob',           // job_name
    ['number' => 123, 'name' => 'Bob'], // job_params
    ['queue_name' => 'default']         // job_options
);

The Versions

30/07 2018

dev-master

9999999-dev http://github.com/lightster/hodor

PHP/rabbitmq-based job queue

  Sources   Download

MIT

The Requires

 

The Development Requires

php rabbitmq queue job hodor

30/07 2018

dev-remove-pier-config

dev-remove-pier-config http://github.com/lightster/hodor

PHP/rabbitmq-based job queue

  Sources   Download

MIT

The Requires

 

The Development Requires

php rabbitmq queue job hodor

09/11 2017
05/05 2017

dev-move-scheduled-jobs-to-a-separate-table

dev-move-scheduled-jobs-to-a-separate-table http://github.com/lightster/hodor

PHP/rabbitmq-based job queue

  Sources   Download

MIT

The Requires

 

The Development Requires

php rabbitmq queue job hodor

28/12 2016

dev-update-ravens-and-php-amqplib

dev-update-ravens-and-php-amqplib http://github.com/lightster/hodor

PHP/rabbitmq-based job queue

  Sources   Download

MIT

The Requires

 

The Development Requires

php rabbitmq queue job hodor

20/11 2016
06/10 2015

v0.0.2

0.0.2.0 http://github.com/lightster/hodor

PHP/rabbitmq-based job queue

  Sources   Download

The Requires

 

The Development Requires

php rabbitmq queue job hodor

29/03 2015

v0.0.1

0.0.1.0 http://github.com/lightster/hodor

PHP/rabbitmq-based job queue

  Sources   Download

The Requires

 

The Development Requires

php rabbitmq queue job hodor

12/03 2015

v0.0

0.0.0.0 http://github.com/lightster/hodor

PHP/rabbitmq-based job queue

  Sources   Download

The Requires

 

The Development Requires

php rabbitmq queue job hodor