PHP Classes

MesQ PHP Queue Management System: Queue and pull messages store in directory files

Recommend this page to a friend!
  Info   View files Documentation   View files View files (15)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 70 All time: 10,268 This week: 488Up
Version License PHP version Categories
mesq 1.0.0GNU Lesser Genera...7Tools, Files and Folders, PHP 7
Description 

Author

This package can queue and pull messages store in directory files.

It can take messages that can be pushed to a queue that is stored in files in queue directory.

The package can also pull the queue messages by retrieving them from queue directory.

The messages can queued and pulled from the queue by a configurable sorting methods. Currently it supports several types of sorting methods: FIFO (First In, First Out), LIFO (Last In, Last Out), assigned priority to each message.

Innovation Award
PHP Programming Innovation award nominee
March 2021
Number 5


Prize: One subscription to the PDF edition of the PHP Architect magazine
Message queues are useful structures to store requests to perform tasks as soon as possible, but need to executed by the order of queuing.

There are many message queuing solution types. Some rely on having a specify message queuing server software.

This package provides a simple solution that relies only local files to store messages in a queue.

Manuel Lemos
Picture of Kjell-Inge Gustafsson
  Performance   Level  
Name: Kjell-Inge Gustafsson <contact>
Classes: 15 packages by
Country: Sweden Sweden
Age: ???
All time rank: 4922 in Sweden Sweden
Week rank: 311 Up2 in Sweden Sweden Equal
Innovation award
Innovation award
Nominee: 6x

Documentation

[comment]: # (This file is part of MesQ, PHP disk based message lite queue manager. Copyright 2021 Kjell-Inge Gustafsson, kigkonsult, All rights reserved, licence LGPLv3)

MesQ

About

MesQ is a PHP lite disk based message queue manager

  • Assemple and queue (un-)frequently (incoming) messages
  • process once or 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 single message to queue

<?php
namespace Kigkonsult\MesQ;

require 'vendor/autoload.php';

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

MesQ::qPush( $config, <message> );
...

Add messages to queue

<?php
namespace Kigkonsult\MesQ;

require 'vendor/autoload.php';

...
$mesQ = MesQ::factory( 
    [
        MesQ::QUEUENAME => <queueName>,
        MesQ::DIRECTORY => <directory>
    ];
);
foreach( <messages> as $message ) {
    $mesQ->push( $message );
} // end foreach
...

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] doc, ReleaseNotes and for test, review test/test.sh.

Installation

[Composer], from the Command Line:

composer require kigkonsult/mesq

In your composer.json:

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

Sponsorship

Donation using [paypal.me/kigkonsult] are appreciated. For invoice, [e-mail]</a>.

Licence

MesQ is licensed under the LGPLv3 License.

[Composer]:https://getcomposer.org/ [e-mail]:mailto:ical@kigkonsult.se [MesQ]:docs/MesQ.md [paypal.me/kigkonsult]:https://paypal.me/kigkonsult


  Files folder image Files  
File Role Description
Files folder image.github (1 file)
Files folder imagedocs (1 file)
Files folder imagesrc (2 files)
Files folder imagetest (6 files)
Accessible without login Plain text file autoload.php Aux. Auxiliary script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENCE Lic. License text
Accessible without login Plain text file README.md Doc. Read me
Accessible without login Plain text file releaseNotes.txt Doc. 1.05

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files  /  docs  
File Role Description
  Accessible without login Plain text file MesQ.md Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file MesQ.php Class Class source
  Plain text file MesQinterface.php Class Class source

  Files folder image Files  /  test  
File Role Description
  Accessible without login Plain text file messageLoader.php Example Example script
  Accessible without login Plain text file messageLoader2.php Example Example script
  Accessible without login Plain text file messageReader.php Example Example script
  Accessible without login Plain text file test.inc.php Aux. Auxiliary script
  Accessible without login Plain text file test.sh Data Auxiliary data
  Plain text file TestMessage.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:70
This week:0
All time:10,268
This week:488Up