2017 © Pedro Peláez
 

library skeleton-transaction

Background tasks for skeleton

image

tigron/skeleton-transaction

Background tasks for skeleton

  • Monday, June 11, 2018
  • by tigron
  • Repository
  • 3 Watchers
  • 0 Stars
  • 3,074 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 12 % Grown

The README.md

skeleton-transaction

Description

Transactions for Skeleton. Transactions are used to perform background tasks., (*1)

Installation

Installation via composer:, (*2)

composer require tigron/skeleton-transaction

Howto setup

Run the initial migrations, (*3)

Create transactions

Transactions should all extend from \Skeleton\Transaction\Transaction and should implement the run() method:, (*4)

<?php
/**
 * Transaction_Test
 *
 * @author Christophe Gosiau <christophe@tigron.be>
 */
class Transaction_Test extends \Skeleton\Transaction\Transaction {

    /**
     * Run
     *
     * @access public
     */
    public function run() {
        // Do your thing
        $data = $this->get_data();
    }
}

Schedule your transaction, (*5)

$transaction = new Transaction_Email_Order_Canceled();
$data = [ 'some_data' => 'some_value ];
$transaction->data = $data;
$transaction->schedule();

Manage the daemon

Start the transaction daemon with the skeleton binary:, (*6)

skeleton transaction:daemon start

Stop the transaction daemon, (*7)

skeleton transaction:daemon stop

Get the status of the daemon, (*8)

skeleton transaction:daemon status

Interact with transactions

Get a list of all scheduled transactions, (*9)

skeleton transaction:list

Run a transaction, (*10)

skeleton transaction:run <transaction_id>

Show the log of a transaction, (*11)

skeleton transaction:log <transaction_id_or_classname>

Monitor the daemon with Nagios

Skeleton Transaction Daemon can be monitored via its status file. The status file is updated every 5 seconds and can be configured via Config:, (*12)

\Skeleton\Transaction\Config::$monitor_file = '/tmp/skeleton-transaction.status';

To monitor the daemon via Nagios, a \Skeleton\Core\Web\Module is provided which will read the status file and return an appropiate response., (*13)

To enable Nagios monitoring, make sure to create a module in your application that will handle the monitoring request:, (*14)

<?php
/**
  * Module monitor
  *
  * @author Christophe Gosiau <christophe@tigron.be>
  */
class Web_Module_Monitor extends \Skeleton\Transaction\Web\Module\Monitor {
}

Optionally, an authentication header can be configured:, (*15)

\Skeleton\Transaction\Config::$monitor_authentication = 'YOUR_SECRET_STRING';

Nagios configuration

In Nagios, you should configure a command to call the service. We will use the built-in check_http command as a starting point:, (*16)

define command {
    command_name    check_skeleton_http
    command_line    /usr/lib/nagios/plugins/check_http -H $ARG1$ -u $ARG2$ -k 'X-Authentication: $ARG3$'
}

Your service definition could then look like this:, (*17)

define service {
    use                             generic-service
    host_name                       hostname.example.com
    service_description             SKELETON
    check_command                   check_skeleton_http!app.hostname.example.com!/monitor!AuThEnTiCaTiOnStRiNg
}

The Versions

11/06 2018

dev-master

9999999-dev

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

30/01 2018

v0.2.8

0.2.8.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

09/01 2018

v0.2.7

0.2.7.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

09/08 2017

v0.2.6

0.2.6.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

02/06 2017

v0.2.5

0.2.5.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

26/05 2017

v0.2.4

0.2.4.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

08/02 2017

v0.2.3

0.2.3.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

30/01 2017

v0.2.2

0.2.2.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

16/01 2017

v0.2.1

0.2.1.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

11/01 2017

v0.2.0

0.2.0.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

15/11 2016

v0.1.2

0.1.2.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

15/11 2016

v0.1.1

0.1.1.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

01/07 2016

v0.1.0

0.1.0.0

Background tasks for skeleton

  Sources   Download

MIT

The Development Requires

by Tigron BVBA

26/10 2015

v0.0.1

0.0.1.0

Background tasks for skeleton

  Sources   Download

MIT

by Tigron BVBA