
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Currently:
from laravel_queue import Queue
connection_string = "postgresql://user:password@host:5432/db"
queue = Queue(connection_string)
connection: str or sqlalchemy.engine.base.Engine
queue: str, default 'python', the queue name in the database
jobs_table: str, default 'jobs.jobs', the table name for the jobs
failed_jobs_table: str, default 'jobs.failed_jobs', the table name for the failed jobs
jobs = queue.jobs ## List of jobs in queue object
while queue.jobs:
jobs = queue.jobs
for job in jobs:
job.run(function) ## run any function
function can be any function to run for this job Using the while loop allows any new jobs placed on the queue while processing to be carried out next.
To pass params in laravel to the python function, specify a param_map
in the run function.
# laravel:
$this->groupId = 12;
# python
def function(group_id):
pass
job.run(function, param_map={
'groupId': 'group_id'
})
Additionally, you can specify a cache_lock_uid
This can be either a str or a list of strings.
This is to be used for managing the job cache if you are using the ShouldBeUnique
or ShouldBeUniqueUntilProcessing
properties in Laravel
The cache_lock_uid
should resemble what you have set uniqueId()
to in laravel.
If a list is sent, you can specify parameters to be filled with $
:
# Laravel:
$this->param1 = 1
$this->param2 = 2
public function uniqueId(): string
{
return $this->param1 . '-' . $this->param2;
}
# Python
job.run(function_name,
param_map = {
'param1': 'param1',
'param2': param2'
}
cache_lock_uid = ['$param1', '-', '$param2'])
## $param1 and $param2 will be swapped in with the cooresponding value.
To use cache locks, you must specify the database as your cache for queue. You can do this as so:
public function uniqueVia(): Repository
{
return Cache::driver('database');
}
If using the ShouldBeUniqueUntilProcessing
property, you must specify that in you job runner as well.
By default (unique_until_processing=False
), the cache lock will be relased after processing, emulating the ShouldBeUnique
laravel property.
Setting this unique_until_processing=True
will relase this lock at the start of the job, like ShouldBeUniqueUntilProcessing
FAQs
Reads from a Laravel queue
We found that laravel-queue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.