2017 © Pedro Peláez
 

library service-dispatcher

image

rkr/service-dispatcher

  • Wednesday, April 4, 2018
  • by rkr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 154 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 3 % Grown

The README.md

php-service-dispatcher

Build Status Scrutinizer Code Quality Latest Stable Version License, (*1)

Common usage using SQLite

A simple service dispatcher for shell scripts. The intent is to run a php-cli script every minute and let the script decide, what to run at what time..., (*2)

use Kir\Services\Cmd\Dispatcher\Dispatcher;

require __DIR__ . '/vendor/autoload.php';

use Kir\Services\Cmd\Dispatcher\ServiceDispatcherBuilder;

$dispatcher = ServiceDispatcherBuilder::withSQLite(__DIR__.'/services.db')->build();

$dispatcher->register('service1', Dispatcher::ONE_HOUR, function () {
    // Do something
    throw new Exception();
});

$dispatcher->register('service2', Dispatcher::ONE_HOUR * 3, function () {
    // Do something
});

$dispatcher->run();

The example above show the simplest usage of the service dispatcher. Two services get registered. "Service1" and "Service2". If one service throws an exception, the whole execution stops. Next time, the failed service starts at the end of the queue. If a service was successfully executed, the timeout schedules the service in this case to 1 hour (3600 seconds) in the future., (*3)

MySQL-Specific settings:

use Kir\Services\Cmd\Dispatcher\ServiceDispatcherBuilder;

require __DIR__ . '/vendor/autoload.php';

/* ...  */

$dispatcher = ServiceDispatcherBuilder::withMySQL($pdo)
->useLocking(true)
->setLockPrefix('my-app:')
->build();

$dispatcher->register(/*...*/);

/* ...  */

The Versions

04/04 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

21/02 2018

0.1.6.2

0.1.6.2

  Sources   Download

MIT

The Requires

 

The Development Requires

22/06 2016

0.1.6.1

0.1.6.1

  Sources   Download

MIT

The Requires

 

The Development Requires

15/12 2015

0.1.6

0.1.6.0

  Sources   Download

MIT

The Requires

 

The Development Requires

09/12 2015

0.1.5.1

0.1.5.1

  Sources   Download

MIT

The Requires

 

The Development Requires

07/12 2015

0.1.5

0.1.5.0

  Sources   Download

MIT

The Requires

 

The Development Requires

21/11 2015

0.1.4

0.1.4.0

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2015

0.1.3

0.1.3.0

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2015

0.1.2

0.1.2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2015

0.1.1

0.1.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2015

0.1

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

27/04 2015

0.0.4

0.0.4.0

  Sources   Download

MIT

The Requires

 

The Development Requires

13/11 2014

0.0.3.4

0.0.3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

13/11 2014

0.0.3.3

0.0.3.3

  Sources   Download

MIT

The Requires

 

The Development Requires

12/11 2014

0.0.3.2

0.0.3.2

  Sources   Download

MIT

The Requires

 

The Development Requires

11/11 2014

0.0.3.1

0.0.3.1

  Sources   Download

MIT

The Requires

 

The Development Requires

12/05 2014

0.0.3

0.0.3.0

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires

12/05 2014

0.0.2

0.0.2.0

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires

12/05 2014

0.0.1

0.0.1.0

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires