<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
telkins / laravel-job-funneling-middleware example snippets
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Telkins\JobFunnelingMiddleware\Funneled;
class TestJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable;
public function handle()
{
// your job logic
}
public function middleware()
{
return [new Funneled()];
}
}
/*
* Determine the time at which the job should timeout.
*
*/
public function retryUntil() : \DateTime
{
return now()->addDay();
}
// in your job
public function middleware()
{
$funneledMiddleware = (new Funneled())
->limit(3)
->releaseAfterSeconds(90);
return [$funneledMiddleware];
}
// in your job
public function middleware()
{
$funneledMiddleware = (new Funneled())
->connection('my-custom-connection')
->key('my-custom-key');
return [$funneledMiddleware];
}
// in your job
public function middleware()
{
$shouldFunnelJobs = Carbon::now()->month === 1;
$funneledMiddleware = (new Funneled())
->enabled($shouldFunnelJobs);
return [$funneledMiddleware];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.