mbm-rafal/laravel-single-dispatch
Larablocks Analysis
mbm-rafal/laravel-single-dispatch works with any PHP project: the latest release (1.0.0, May 28, 2017) doesn't depend on Laravel.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: May 28, 2017)
- 0 downloads a month (needs 10,000)
- 4 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: May 28, 2017.
- No releases in the last 12 months.
- First released: May 28, 2017.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.
| Install | |
|---|---|
composer require mbm-rafal/laravel-single-dispatch |
|
| Latest Version: | 1.0.0 |
| PHP: | >=5.5.9 |
| License: | MIT |
| Last Updated: | May 28, 2017 |
| Links: | GitHub · Packagist |
Single Dispatch
Extension for laravel dispatcher that do not allow to proceed same jobs on queues. Motivation for this feature is to not overuse resources while specific job is still waiting to be processed another one should not be queued.
Features
- Allows to catch and ignore duplicated jobs
Requirements
Installed https://laravel.com/docs/5.4/queues
Installation
Require the mbm-rafal/laravel-single-dispatch package in your composer.json and update your dependencies.
$ composer require mbm-rafal/laravel-single-dispatch
$ composer update
Publish migration files
$ php artisan vendor:publish --provider="MBM\Bus\BusServiceProvider" --force
Run migrations
$ php artisan migrate
Usage
To use this extension you have to update resource resolved by provided by Dispatcher::class to do
so, simply switch BusServiceProvider in app/config.php
// Illuminate\Bus\BusServiceProvider::class,
\MBM\Bus\BusServiceProvider::class,
You have to apply code to Queue events in AppServiceProvider
# Manage processed jobs
Queue::after(function (JobProcessed $event) {
app(\MBM\Bus\Dispatcher::class)->unregister($event->job);
});
Queue::failing(function (JobFailed $event) {
app(\MBM\Bus\Dispatcher::class)->unregister($event->job);
});
If you want to allow job to be duplicated add interface to Job class definition
use Illuminate\Contracts\Queue\ShouldQueue;
use \MBM\Bus\AllowDuplicates
class CustomJob implements ShouldQueue, AllowDuplicates
{
// Code
}
License
Released under the MIT License, see LICENSE.
Related Packages
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 1.0.0 | >=5.5.9 | MIT |