mf4php / mf4php-beanstalk
This is an mf4php binding for Beanstalk.
1.1.3
2014-02-20 16:46 UTC
Requires
- php: >=5.3.0
- lf4php/lf4php: ~4.0
- mf4php/mf4php: ~1.1
- pda/pheanstalk: v2.1.0
Requires (Dev)
- lf4php/lf4php-log4php: dev-master
This package is not auto-updated.
Last update: 2024-12-21 13:38:54 UTC
README
This is a Beanstalk binding for mf4php
Attention
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.
Configuration
<?php $dispatcher = new BeanstalkMessageDispatcher($pheanstalk); $queue = new DefaultQueue('queue'); /* @var $listener MessageListener */ $dispatcher->addEventListener($queue, $listener);
Send events
<?php /* @var $object Serializable */ $message = new BeanstalkMessage($object); $dispatcher->send($queue, $message); // onMessage method in $listener is called