PHP code example of renkun-cook / think-queue-manage

1. Go to this page and download the library: Download renkun-cook/think-queue-manage 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/ */

    

renkun-cook / think-queue-manage example snippets


项目根目录/config/queue.php


return [
    'default'     => 'database',
    'connections' => [
        'sync'     => [
            'driver' => 'sync',
        ],
        'database' => [
            'type' => 'database',
            'queue'  => 'default',
            'table'  => 'jobs',
            'queues'   => [
                'helloJobQueue' => [
                    'delay'   => 0,
                    'sleep'   => 3,
                    'tries'   => 1,
                    'memory'  => 128,
                    'timeout' => 60,
                    'processNum' => 1
                ],
                'testJob' => [
                    'delay'   => 0,
                    'sleep'   => 3,
                    'tries'   => 3,
                    'memory'  => 128,
                    'timeout' => 60,
                    'processNum' => 1
                ],
            ]
        ],
        'redis'    => [
            'driver'     => 'redis',
            'queue'      => 'default',
            'host'       => '127.0.0.1',
            'port'       => 6379,
            'password'   => '',
            'select'     => 0,
            'timeout'    => 0,
            'persistent' => false,
        ],
    ],
    'failed'      => [
        'type'  => 'database',
        'table' => 'failed_jobs',
    ],
];