merkeleon/laravel-nsq

Laravel NSQ
7,625 6
Install
composer require merkeleon/laravel-nsq
Latest Version:v2.2.2
PHP:^7.1.3
Laravel:6 · 7 · 8
Older releases:5
Last Updated:Aug 23, 2022
Links: GitHub  ·  Packagist
Maintainer: codeator

merkeleon-nsq

Laravel package for NSQ queue manager that uses Laravel's API

Installation

First, require the package using Composer:

composer require merkeleon/laravel-nsq

  1. Add new queue job as described in Laravel's manual:

php artisan make:job <JobName> Edit this file according to Laravel's rules

  1. Set queue driver to NSQ

QUEUE_DRIVER=nsq

  1. Set env options for NSQ servers:

NSQSD_URL=127.0.0.1:4150 IP and port for Nsq daemon

NSQLOOKUP_URL=127.0.0.1:4161 IP and port for Nsq lookup daemon

Use comma as separator if you want to use several servers:

NSQSD_URL=127.0.0.1:4150,127.0.0.1:4151,127.0.0.1:4152

Example

Job class

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Config;

class CoolJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function __construct(...$args)
    {
        $this->queue = 'my-cool-jobs';
        
        // $args code
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        // do the job
    }
}

Some where in a code

<?php

... code ...

// Push timed task in the queue
CoolJob::dispatch(...$any_args);

... code ...

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
v2.2.2 ^7.1.3 6.*|7.*|8.*
2.2.1 ^7.1.3 6.*|7.*|8.*
2.2.0 ^7.1.3 6.*|7.*
2.1.4 ^7.1.3 6.*
2.1.3 ^7.1.3 6.*