2017 © Pedro Peláez
 

library emphloyer-pdo

PDO backend for Emphloyer

image

mkrmr/emphloyer-pdo

PDO backend for Emphloyer

  • Sunday, September 28, 2014
  • by mkrmr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 337 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 11 % Grown

The README.md

Emphloyer-PDO

This extension provides a PDO backend for Emphloyer. This extension has only been tested with MySQL but likely works with other SQL databases as well., (*1)

NOTE: If you're replicating the MySQL database that holds you jobs table be sure to use MIXED or ROW based replication (STATEMENT based replication will generate tons of warnings because the backend uses UPDATE queries with a WHERE statement to lock jobs)., (*2)

Installation

You can install Emphloyer-PDO through composer with:, (*3)

composer require mkrmr/employer-pdo

To use Employer-PDO you need to install the UUID pecl extension., (*4)

Usage

To use the PDO extension specify it as the backend in your configuration file like so:, (*5)

$pipelineBackend = new \Emphloyer\Pdo\PipelineBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password");

If you want to use a specific table name for your jobs you can pass it to the constructor (emphloyer_jobs is the default):, (*6)

$pdoAttributes = [];
$pipelineBackend = new \Emphloyer\Pdo\PipelineBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password", $pdoAttributes, "emphloyer_jobs");

You also need to create the database table, in a MySQL database you would create the table like so:, (*7)

CREATE table emphloyer_jobs (
   uuid VARCHAR(36) PRIMARY KEY, 
   created_at TIMESTAMP, 
   run_from TIMESTAMP NULL DEFAULT NULL, 
   locked_at TIMESTAMP NULL DEFAULT NULL, 
   lock_uuid VARCHAR(36) UNIQUE, 
   status VARCHAR(20), 
   class_name VARCHAR(255), 
   type VARCHAR(100),
   attributes TEXT
);

If you want to use the Scheduler in addition to the Pipeline you need to add the following to the configuration file:, (*8)

$schedulerBackend = new \Emphloyer\Pdo\SchedulerBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password");

If you want to use a specific table name for your jobs you can pass it to the constructor (emphloyer_scheduled_jobs is the default):, (*9)

$pdoAttributes = [];
$schedulerBackend = new \Emphloyer\Pdo\SchedulerBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password", $pdoAttributes, "emphloyer_scheduled_jobs");

You also need to create the database table, in a MySQL database you would create the table like so:, (*10)

CREATE table emphloyer_scheduled_jobs (
   id INT AUTO_INCREMENT,
   uuid VARCHAR(36) UNIQUE, 
   created_at TIMESTAMP, 
   locked_at TIMESTAMP NULL DEFAULT NULL, 
   lock_uuid VARCHAR(36), 
   class_name VARCHAR(255), 
   attributes TEXT, 
   minute TINYINT(1) DEFAULT NULL, 
   hour TINYINT(1) DEFAULT NULL, 
   monthday TINYINT(1) DEFAULT NULL,
   month TINYINT(1) DEFAULT NULL,
   weekday TINYINT(1) DEFAULT NULL,
   PRIMARY KEY (id)
);

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes, please make sure you adhere to the Doctrine coding standard as much as possible (phpcs configuration is included)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new pull request on GitHub

The Versions

28/09 2014

dev-master

9999999-dev

PDO backend for Emphloyer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Kremer

28/09 2014

v0.4.1

0.4.1.0

PDO backend for Emphloyer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Kremer

18/05 2014

v0.4.0

0.4.0.0

PDO backend for Emphloyer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Kremer

14/05 2014

v0.3.0

0.3.0.0

PDO backend for Emphloyer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Kremer

11/05 2014

v0.2.0

0.2.0.0

PDO backend for Emphloyer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Kremer

08/11 2013

v0.1.1

0.1.1.0

PDO backend for Emphloyer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Kremer

07/11 2013

v0.1.0

0.1.0.0

PDO backend for Emphloyer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Kremer