PHP code example of slm / queue-beanstalkd

1. Go to this page and download the library: Download slm/queue-beanstalkd 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/ */

    

slm / queue-beanstalkd example snippets


return array(
    'slm_queue' => array(
        'queue_manager' => array(
            'factories' => array(
                'email' => 'SlmQueueBeanstalkd\Factory\BeanstalkdQueueFactory'
            )
        )
    )
);

$queue->push($job, array(
    'priority' => 20,
    'delay'    => 23,
    'ttr'      => 50
));

use SlmQueue\Job\AbstractJob;
use SlmQueueBeanstalkd\Job\Exception;

class SimpleJob extends AbstractJob
{
    public function execute()
    {
        // Bury the job, with a priority of 10
        throw new Exception\BuryableException(array('priority' => 10));

        // Release the job, with a priority of 10 and delay of 5 seconds
        throw new Exception\ReleasableException(array('priority' => 10, 'delay' => 5));
    }
}