Installation Add the package via Composer:
composer require duguncom/queue-bundle
Register the bundle in config/app.php under providers:
Dugincom\QueueBundle\QueueBundle::class,
Configuration Publish the default config:
php artisan vendor:publish --provider="Dugincom\QueueBundle\QueueBundle" --tag="config"
Edit config/queue.php (if provided) or check the bundle’s default settings.
First Use Case Dispatch a job using Laravel’s queue facade:
use Illuminate\Support\Facades\Queue;
Queue::push(new \App\Jobs\ProcessPodcast);
Verify the job is processed by checking the configured queue driver (e.g., database, redis).
Job Dispatching Use Laravel’s built-in queue helpers:
// Delayed job
Queue::later(now()->addMinutes(10), new \App\Jobs\SendEmail);
// Batch processing
Queue::batch(new \App\Jobs\GenerateReport, 5);
Queue Monitoring
Extend the bundle’s monitoring capabilities (if available) or integrate with Laravel’s queue:work:
php artisan queue:work --sleep=3 --tries=3
Custom Queue Connections
Define a custom connection in config/queue.php:
'connections' => [
'custom' => [
'driver' => 'database',
'table' => 'custom_jobs',
'queue' => 'custom_queue',
],
],
Use it in jobs:
Queue::connection('custom')->push(new \App\Jobs\CustomJob);
event(new PodcastPublished($podcast));
// In listener:
Queue::push(new ProcessPodcast($podcast));
Queue::before(function ($job, $data) {
logger()->info("Job {$job->getJob()} dispatched");
});
Queue::push(new \App\Jobs\FragileJob)->retryUntil(5);
Outdated Package
Lack of Documentation
vendor/duguncom/queue-bundle/src/Console for clues.Queue Driver Assumptions
database). If using redis or beanstalkd, ensure the bundle doesn’t override configurations silently.Job Stuck in Queue?
Manually inspect the queue table (for database driver):
SELECT * FROM jobs WHERE queue = 'default';
Delete stale jobs with:
php artisan queue:flush
Logs
Enable queue logging in config/queue.php:
'logging' => true,
Custom Job Classes
Extend Laravel’s Illuminate\Bus\Queueable for shared logic:
class BaseJob implements ShouldQueue {
use Dispatchable, InteractsWithQueue, Queueable;
// Shared retry/timeout logic
}
Service Provider Hooks
Override bundle behavior by binding interfaces in your AppServiceProvider:
public function register() {
$this->app->bind(
\Dugincom\QueueBundle\Contracts\QueueWorker::class,
\App\Services\CustomQueueWorker::class
);
}
Queue Events Listen for queue events (if supported):
Queue::after(function ($job, $data) {
// Post-processing
});
Queue::fake() in tests:
public function test_job_processing() {
Queue::fake();
Queue::push(new \App\Jobs\TestJob);
Queue::assertPushed(\App\Jobs\TestJob::class);
}
supervisorctl reread
supervisorctl update
How can I help you explore Laravel packages today?