2017 © Pedro Peláez
 

library wq-beanstalkd

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

image

mle86/wq-beanstalkd

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  • Monday, July 9, 2018
  • by mle86
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

WQ-Beanstalkd (mle86/wq-beanstalkd)

This package contains the PHP class mle86\WQ\WorkServerAdapter\BeanstalkdWorkServer., (*1)

It supplements the mle86/wq package by implementing its WorkServerAdapter interface., (*2)

It connects to a Beanstalkd server using the pda/pheanstalk package by Paul Annesley., (*3)

Version and Compatibility

This is version 1.0.2 of mle86/wq-beanstalkd., (*4)

It was developed for version 1.0.0 of mle86/wq and should be compatible with all of its future 1.x versions as well., (*5)

Installation and Dependencies

$ composer require mle86/wq-beanstalkd

It requires PHP 7.1, mle86/wq, and pda/pheanstalk., (*6)

Class reference

class mle86\WQ\WorkServerAdapter\BeanstalkdWorkServer implements WorkServerAdapter, (*7)

getNextQueueEntry() uses the RESERVE command, buryEntry() uses the BURY command, storeJob() and requeueEntry() use the PUT command, and deleteEntry() uses the DELETE command., (*8)

Work Queues are Beanstalkd's “tubes”., (*9)

  • public function __construct (Pheanstalk $pheanstalk)
    Constructor. Takes an already-configured Pheanstalk instance to work with. Does not attempt to establish a connection itself – use the connect() factory method for that instead.
  • public static function connect (string $host = "localhost", int $port = PheanstalkInterface::DEFAULT_PORT, int $connectTimeout = null)
    Factory method. See Pheanstalk::__construct for the parameter descriptions.

Interface methods which are documented in the WorkServerAdapter interface:, (*10)

  • public function storeJob (string $workQueue, Job $job, int $delay = 0)
  • public function getNextQueueEntry ($workQueue, int $timeout = DEFAULT_TIMEOUT) : ?QueueEntry
  • public function buryEntry (QueueEntry $entry)
  • public function requeueEntry (QueueEntry $entry, int $delay, string $workQueue = null)
  • public function deleteEntry (QueueEntry $entry)

Usage example

<?php
use mle86\WQ\WorkServerAdapter\BeanstalkdWorkServer;
use mle86\WQ\WorkProcessor;
use mle86\WQ\Job\Job;

$processor = new WorkProcessor( BeanstalkdWorkServer::connect("localhost") );

while (true) {
    $processor->processNextJob("mail", function(Job $job) {
        $job->...;
    });
}

This executes all jobs available in the local Beanstalkd server's “mail” tube, forever. It will however abort if one of the jobs throws an exception – you might want to add a logging try-catch block around the processNextJob() call as shown in WQ's “Quick Start” example., (*11)

The Versions

09/07 2018

dev-master

9999999-dev

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires

09/07 2018

dev-develop

dev-develop

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires

09/07 2018

v1.0.0

1.0.0.0

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires

01/03 2018

v0.4.1

0.4.1.0

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires

05/12 2017

v0.4.0

0.4.0.0

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires

30/09 2017

v0.3.0

0.3.0.0

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires

23/09 2017

v0.2.0

0.2.0.0

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires

12/05 2017

v0.1

0.1.0.0

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

  Sources   Download

MIT

The Requires

 

The Development Requires