I want to send a Laravel queue job from a Python app. How this can be achievable?
If dispatching a job from another app is your goal, perhaps you can simply have a controller on the Laravel app which accepts job requests, generates a job and dispatches it for you like in the example at https://laravel.com/docs/11.x/queues#dispatching-jobs
The example is reproduced here for completeness:
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Jobs\ProcessPodcast;
use App\Models\Podcast;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class PodcastController extends Controller
{
/**
* Store a new podcast.
*/
public function store(Request $request): RedirectResponse
{
$podcast = Podcast::create(/* ... */);
// ...
ProcessPodcast::dispatch($podcast);
return redirect('/podcasts');
}
}
Then your python app can simply send a HTTP request to the controller in order to trigger the job.