PHP lite disk based message queue manager

Fund package maintenance!
Other

v1.6 2021-11-02 13:58 UTC

This package is auto-updated.

Last update: 2024-11-29 06:29:02 UTC


README

About

MesQ is a PHP lite disk based message queue manager

  • Assemple and enqueue (un-)frequently (incoming) messages
  • dequeue once (scheduled?)

MesQ supports FIFO, LIFO and PRIOrity message queues

Message can be any of scalar, array or object types

Usage

Requires (below)

  • unique <queueName>
  • existing read-/writeable <directory>

For the MesQ config keys, please review src/MesQinterface.php.

Add messages to queue

<?php
namespace Kigkonsult\MesQ;

require 'vendor/autoload.php';

...
$config = [
    MesQ::QUEUENAME => <queueName>,
    MesQ::DIRECTORY => <directory>,
    MesQ::QUEUETYPE => MesQ::FIFO, // default
];

MesQ::factory( $config )
    ->push( <message> );
...

Process queued messages

<?php
namespace Kigkonsult\MesQ;

require 'vendor/autoload.php';

...
$config = [
    MesQ::QUEUENAME       => <queueName>,
    MesQ::DIRECTORY       => <directory>,
    MesQ::RETURNCHUNKSIZE => 1000
];

$mesQ = MesQ::factory( $config );
if( $mesQ->messageExists() {
    while( $message = $mesQ->getMessage()) {
        ...
        // process message, max 1000
        ...
    } // end while
} // end if

...

For more detailed usage, read MesQ docs.

Installation

Composer, from the Command Line:

composer require kigkonsult/mesq

In your composer.json:

{
    "require": {
        "kigkonsult/mesq": "dev-master"
    }
}

Version 1.6 supports PHP 8.0, 1.4 7.4, 1.2 7.0.

Sponsorship

Donation using paypal.me/kigkonsult are appreciated. For invoice, e-mail.

Licence

MesQ is licensed under the LGPLv3 License.