This is an mf4php binding for Beanstalk.

1.1.3 2014-02-20 16:46 UTC

This package is not auto-updated.

Last update: 2023-03-18 05:33:24 UTC


This is a Beanstalk binding for mf4php


You have to create your own long running script to reserve messages from beanstalk and forward jobs to the dispatcher.

The reason why it is not implemented in the dispatcher is it should watch several queues, which is impossible in one process. Another reason is that it is often necessary to create a lightweight long running script without any open resources (database, etc.), and it executes a CLI program to pass the message to the dispatcher.


$dispatcher = new BeanstalkMessageDispatcher($pheanstalk);
$queue = new DefaultQueue('queue');

/* @var $listener MessageListener */
$dispatcher->addEventListener($queue, $listener);

Send events

/* @var $object Serializable */
$message = new BeanstalkMessage($object);
$dispatcher->send($queue, $message);
// onMessage method in $listener is called