PHP code example of janfish / async-caller
1. Go to this page and download the library: Download janfish/async-caller 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/ */
janfish / async-caller example snippets
$asyncModel = new Janfish\Phalcon\AsyncCall\Server([
'host' => 'beanstalkd2',
'port' => '11300',
'tube' => 'test_tube',
'workerNum' => 2,
'reserveTimeout' => 2,
'maxRequest' => 2000,
'cron' => 200,
'daemonize' => false,
'pidFile' => __DIR__.'/.async_task.pid',
'logPath' => __DIR__.'/async.log',
]);
$asyncModel->start();
$asyncModel = new Janfish\Phalcon\AsyncCall\Server([
'pidFile' => __DIR__.'/.async_task.pid',
]);
$asyncModel->restart();
$asyncModel = new Janfish\Phalcon\AsyncCall\Server([
'pidFile' => __DIR__.'/.async_task.pid',
]);
$asyncModel->stop();
$asyncModel = new Janfish\Phalcon\AsyncCall\Server([
'host' => 'beanstalkd2',
'port' => '11300',
'tube' => 'test_tube1',
'pidFile' => __DIR__.'/.async_task.pid',
],'\\Core\\Mailler');
$asyncModel->start();
$asyncModel = new Janfish\Phalcon\AsyncCall\Server([
'host' => 'beanstalkd2',
'port' => '11300',
'tube' => 'test_tube2',
'pidFile' => __DIR__.'/.async_task_2.pid',
],'\\Core\\Mailler');
$asyncModel->start();
$asyncModel = new Janfish\Phalcon\AsyncCall\Server([
'host' => 'beanstalkd2',
'port' => '11300',
'tube' => 'test_tube',
'workerNum' => 2,
'reserveTimeout' => 2,
'maxRequest' => 112111111112,
'cron' => 200,
'daemonize' => false,
'pidFile' => __DIR__.'/.async_task.pid',
'logPath' => __DIR__.'/async.log',
],'\\Core\\Mailler');
$asyncModel->start();
bash
#!/bin/bash
FOLDER=/data/asyncCallerHub/demo
CMD=${FOLDER}/server_start.php
LOG_FILE=${FOLDER}/async.log
php -f ${CMD}
tail -f ${LOG_FILE}
docker exec -d swoole-cli php /data/asyncCallerHub/demo/server_restart.php