joaoluizjoaquim / laravel-nsq
Nsq driver for Laravel Queue
8.0.14
2021-03-12 12:40 UTC
Requires
- php: >=7.2
- clue/socket-raw: ^1.5
- illuminate/queue: ^8.0
- illuminate/support: ^8.0
- 8.0.14
- 8.0.13
- 8.0.12
- 8.0.11
- 8.0.10
- 8.0.9
- 8.0.8
- 8.0.7
- 8.0.6
- 8.0.5
- 8.0.4
- 8.0.3
- 8.0.2
- 8.0.1
- 8.0.0
- 7.0.0
- 6.0.10
- 6.0.9
- 6.0.8
- 6.0.7
- 6.0.6
- 6.0.5
- 6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- dev-master / 1.0.x-dev
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-tenment
This package is auto-updated.
Last update: 2025-03-12 21:06:46 UTC
README
NSQ client for laravel
Requirements
Dependency | Requirement |
---|---|
PHP | >= 7.2.0 |
Installation
composer require jiyis/laravel-nsq
Usage
Set env
# 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
Create Job
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); ... } }
Publish
// 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);
Subscribe
php artisan queue:work nsq --sleep=3 --tries=3 --timeout=500 --job=App\\Jobs\\NsqTestJob