joaoluizjoaquim/laravel-nsq is a Laravel package for nsq driver for laravel queue.
It currently has 1 GitHub stars and 2.092 downloads on Packagist (latest version 8.0.14).
Install it with composer require joaoluizjoaquim/laravel-nsq.
Discover more Laravel packages by joaoluizjoaquim
or browse all Laravel packages to compare alternatives.
Last updated
NSQ client for laravel
| Dependency | Requirement |
| -------- | -------- |
| PHP | >= 7.2.0 |
composer require jiyis/laravel-nsq
# for publish
NSQSD_URL=127.0.0.1:4150
# for subscribe
NSQLOOKUP_URL=127.0.0.1:4161
# If it is multiple, please separate them with ","
NSQSD_URL=127.0.0.1:4150,127.0.0.1:4250
php artisan make:job NsqTestJob
you need set two property. public $topic; public $channel;
class NsqTestJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $topic = 'test';
public $channel = 'web';
public function handle()
{
$client = $this->job->getCurrentClient();
$payload = json_decode($this->job->getMessage(), true);
...
}
}
// the data you want to be publish
$str = [
'message' => 'this is a message',
'user_id' => 1
];
// not supported dispatch
Queue::connection('nsq')->push(new NsqTestJob, $str);
php artisan queue:work nsq --sleep=3 --tries=3 --timeout=500 --job=App\\Jobs\\NsqTestJob