1. Go to this page and download the library: Download yejune/simpleue 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/ */
yejune / simpleue example snippets
namespace MyProject\MyJob;
use Simpleue\Job\Job;
class MyJob implements Job {
public function manage($job) {
...
try {
...
} catch ( ... ) {
return FALSE;
}
...
return TRUE;
}
...
public function isStopJob($job) {
if ( ... )
return TRUE;
return FALSE;
}
...
}
use Predis\Client;
use Simpleue\Queue\RedisQueue;
use Simpleue\Worker\QueueWorker;
use MyProject\MyJob;
$redisQueue = new RedisQueue(
new Client(array('host' => 'localhost', 'port' => 6379, 'schema' => 'tcp')),
'my_queue_name'
);
$myNewConsumer = new QueueWorker($redisQueue, new MyJob());
$myNewConsumer->start();
use Aws\Sqs\SqsClient;
use Simpleue\Queue\SqsQueue;
use Simpleue\Worker\QueueWorker;
use MyProject\MyJob;
$sqsClient = new SqsClient([
'profile' => 'aws-profile',
'region' => 'eu-west-1',
'version' => 'latest'
]);
$sqsQueue = new SqsQueue($sqsClient, 'my_queue_name');
$myNewConsumer = new QueueWorker($sqsQueue, new MyJob());
$myNewConsumer->start();
use Simpleue\Queue\BeanStalkdQueue;
use Simpleue\Worker\QueueWorker;
use Pheanstalk\Pheanstalk;
use MyProject\MyJob;
$beanStalkdClient = new Pheanstalk('localhost');
$beanStalkdQueue = new BeanStalkdQueue($beanStalkdClient, 'my_queue_name');
$myNewConsumer = new QueueWorker($beanStalkdQueue, new MyJob());
$myNewConsumer->start();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.