I am using laravel queue to get laters record of users If two users use the same functaion at same time , the values get replicated this is my code on controller ……. SendInvitation::dispatch($email,$name,$nhs_number,$appInfo,$userInfo)->onQueue(‘high’); …….. SendInvitation on quaue code public function handle() { try { $user = User::orderBy(‘created_at’,’DESC’)->first(); if($user != null){ $enu_id = $user->invitation_id; }else{ ..
Category : queue
I am a beginner at Laravel. I want to upload files using a queue in Laravel. I have created a simple example in laravel to upload file, but I don’t know how to use queue with upload file. index.blade.php <h2>Upload file</h2> <form action="{{ route(‘file.store’) }}" method="post" enctype="multipart/form-data"> {{{– csrf_field(): This function can be used to ..
I have the following mailable: <?php namespace AppMail; use IlluminateBusQueueable; use IlluminateMailMailable; use IlluminateQueueSerializesModels; class UserLoginDetailsMail extends Mailable { use Queueable, SerializesModels; protected String $username; protected String $email; protected String $password; /** * Create a new message instance. * * @param String $username * @param String $email * @param String $password */ public function __construct(String ..
By default laravel/horizon is starting maxProcesses on initial start. In our environment the new queue is empty until we activate it, so we would prefer an initial boot with the number of minProcesses to reduce the resource usage. Is it possible to configure horizon like this ? Or does anyone know how to achieve this ..
I add job on queue on page load controller and invoke laravel event and broadcast it via socket io to front end. Problem is since this is done on page load, the job is executed before the page fully loaded. As a result, I can see the response appended for a short time while the ..
i want to create customer folders into /public/storage/ based customer id frm database (due to server corrupt) . I try by using Laravel queue. here is my code. This is to create folder only. and when i run php artisan queue:work or listen, nothing happened on my terminal the scenario is system will create folder ..
I am mailing to the users using the queue job. sent mail in background. but when I am sent mail direct to the user {{route(”)}} work properly, but not with queue job. Code in My Email Blade File: {{ route(‘trainer.check_status’) }} Normal Mail: http://mydomail.test/trainer/check_status With Queue Job http://localhost/trainer/check_status please help me to out this issue. ..
A simple job with a 10 second delay is not being queued in mysql database: public function test() { $job = (new test1())->delay(10); $this->dispatch($job); } The job is started when the path /test is viewed (route set up in web.php): Route::get(‘/test’, ‘[email protected]’); The job handle just returns text: public function handle() { echo "Hello"; } ..
In my controller I dispatch all request to my job public function store(Request $request) { ClientJob::dispatch($request->all()); } And How I can get my requests inside handle my job public function handle() { $request; } Sourc..
I am about to setup Redis and Laravel Horizon. Although I have set up everything correctly (I assume) I get a very weird error. Laravel tells me that it is Trying to access array offset on value of type null at vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php:156 The line 156 is the first return line: /** * Resolve a queue ..
I am using sqlite to process the laravel queues and my case did not work due to the sqlite is in different Dyno. The documentation has this information https://devcenter.heroku.com/articles/sqlite3#disk-backed-storage. If you have another alternative using sqllite, I am grateful. The configuration I made is in accordance with this response from the configuration with database: Laravel ..
How to pass priorities (high, medium, low) in AWS SQS in Lumen PHP. Packages "php": "^7.3|^8.0", "aws/aws-sdk-php": "^3.158", "laravel/lumen-framework": "^8.0" queqe.php <?php return [ ‘default’ => env(‘QUEUE_CONNECTION’, ‘sqs’), ‘connections’ => [ ‘sqs’ => [ ‘driver’ => ‘sqs’, ‘key’ => ‘key’, ‘secret’ => ‘secret’, ‘prefix’ => ‘https://sqs.us-east-1.amazonaws.com/1234567891452’, ‘queue’ => ”, ‘suffix’ => ‘dev-test-app’, ‘region’ => ‘us-east-1’, ..
I encountered a strange issue within my laravel system. I was using queue to handle a time consuming task. I noticed that even though I’m running in local, queue did not need queue:work or listen command to work. Also, whatever changes I make in queue is not reflected when executing. I have tried restarting queue ..
I have a Laravel app which is load balanced on 3 servers. – I am now introducing queues to the app and wonder if I should set up a worker on each machine for redundancy or if they will conflict with each other. – I use Laravel Forge for setup each machine wich allows me ..
I’m using Laravel Notifications and trying to send an email via the toMail method. .env file QUEUE_CONNECTION=database Below is the class. <?php namespace AppNotifications; use CarbonCarbon; use IlluminateBusQueueable; use IlluminateContractsQueueShouldQueue; use IlluminateNotificationsMessagesMailMessage; use IlluminateNotificationsNotification; class PlanPurchasedNotification extends Notification implements ShouldQueue { use Queueable; protected $transaction; /** * Create a new notification instance. * * @return ..
Works well when I want to use Laravel’s default email verifier But when I put the same method that sends the email in a queue, the url sent to the user is wrong http://localhost/email/verify/65/36a5c019a9dc059333f38c329f3694d6ba646e36?expires=1614871373&signature=52f2f377d559a6bdd913b6fc210106b352ed1c60ff64cf1166d2b0ec562f086d The above url is incorrect instead of localhost:8000 has only the localhost value User Model public function sendEmailVerificationNotification() { sendEmailVerify::dispatch($this); } ..
After upload files to laravel site if i have been a syntax error ,supervisor service (for queue:work) stop and i have to run: supervisorctl restart all suddenly. Is there any way to auto restart supervisor service after any changes on laravel site? Sourc..
I use Redis as a queue driver and dispatch a job that sends notifications to users. The problem is that users get the same notification multiple times. Laravel 8.0, standard Redis configuration. Supervisor config: [program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/vhosts/website.com/httpdocs/artisan queue:work –sleep=0 –tries=3 –max-time=3600 autostart=true autorestart=true stopasgroup=true killasgroup=true numprocs=10 redirect_stderr=true stdout_logfile=/var/www/vhosts/website.com/httpdocs/storage/logs/worker.log stopwaitsecs=3600 Job: class NotifySubscribersOfReply implements ShouldQueue, ..
When i run queue in production i get this error in laravel log files. I run php artisan queue:work command in server automatically with crontab every minute. [2021-02-18 16:56:02] production.ERROR: Trying to access array offset on value of type null {"exception":"[object] (ErrorException(code: 0): Trying to access array offset on value of type nul$ [stacktrace] #0 ..
I know the jobs are supposed to run asynchronously and they do not suppose to return a value. Still, I’m looking for a solution to somehow pass "up" information obtained in the job. It doesn’t have to be by a return statement, it can be by some other $this->variable in the service or any other ..
I am submitting jobs through queues using Redis. My problem is that I need to be able to tell if the queue or redis is still working. I need to inform the user that redis is processing the queue I send him or rather I need to inform the client that I have not finished ..

I have made an instagram contender that needs to be able to process video conversions(FFMPEG) on a different server because of CPU reasons. Both of my servers are connected by the same database. Currently i have a local redis server working so this way i can push tasks to the background using the default redis ..
Hi I am using Laravel Jobs and want to success a job manually in handle method. I have tried using return but did not work. public function handle() { return; } Sourc..
I got some duplicated row in my table but its impossible to insert via http request because I have validations for user balance that will change by every request and a request must be accepted by admin before another request. In this case The user had a balance of USD 1000. According to my code ..
I am using Laravel supervisor for running job in background on AWS ec2 instance. It is using for very big files import to mysql and its randomly stuck the supervisor. There is no any logs in the log files. How can we check what cause this? Sourc..