PHP code example of mf4php / mf4php-beanstalk
1. Go to this page and download the library: Download mf4php/mf4php-beanstalk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mf4php / mf4php-beanstalk example snippets
$dispatcher = new BeanstalkMessageDispatcher($pheanstalk);
$queue = new DefaultQueue('queue');
/* @var $listener MessageListener */
$dispatcher->addEventListener($queue, $listener);
/* @var $object Serializable */
$message = new BeanstalkMessage($object);
$dispatcher->send($queue, $message);
// onMessage method in $listener is called