Created
March 14, 2017 08:18
-
-
Save eddy8/16a069f0db58ce04ae241339d21a177b to your computer and use it in GitHub Desktop.
laravel queue(v5.3) standalone with redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Queue\Capsule\Manager as Queue; | |
use Illuminate\Redis\Database as Redis; | |
require 'vendor/autoload.php'; | |
$queue = new Queue; | |
$app = $queue->getContainer(); | |
$manager = $queue->getQueueManager(); | |
$queue->addConnection([ | |
'driver' => 'redis', | |
'queue' => 'default', | |
'connection' => 'default', | |
'retry_after' => 90, | |
]); | |
$app->singleton('redis', function () { | |
return new Redis([ | |
'cluster' => false, | |
'default' => [ | |
'host' => '192.168.128.128', | |
'port' => 6379, | |
'database' => 0, | |
], | |
]); | |
}); | |
$queue->setAsGlobal(); | |
$queue->push('SendEmail', array('message' => 'message')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment