Jobs not firing but configured SQS - laravel

I am new to Laravel and i have configured SQS. I have an email send event which is handled in a controller. I see it it is called but it is not sending the email. What is the reason ?

This is a common case when you are not running queue worker. Check Documentation. Start your worker by using php artisan queue:work

Related

Laravel Jobs and Events processing in same queue worker

I'm trying to run a time-intensive process in my jobs queue. I have an event being triggered which sends out a socket command to connected users and I have a job that gets queued after that which can run in the background. Before now, I've never run php artisan queue:work and my events system was working flawlessly. Now I'm trying to process my jobs and my events AND jobs are trying to be processed by the same queue worker.
Here is the code that I use to trigger these:
event(new ActivateItemAndUpdateRotation($id));
ChangeStatus::dispatch($id, $status);
This is really bad for my performance because the users can change statuses really quickly which needs to be updated rapidly and the jobs can just do their thing as they're able to in the background. I've tried adding the jobs to a specific queue and only running that queue worker, but then the events don't get processed at all. So really I have two questions:
how have events been getting processed without running a worker up until now?
is it necessary to have two workers running now to process the events and the jobs asynchronously?

How to consume the message in RabbitMq Laravel using the package bschmitt/laravel-amqp

I am using the Laravel package https://github.com/bschmitt/laravel-amqp/ to publish and consume the message using RabbitMQ in a Microservices based application. I am publishing the message in service and trying to consume the same in another service.
The documentation is pretty clear on the code to consume the published message in the queue. However, in the traditional Laravel queue process, we would describe the process to be performed inside the handle() method. And call the php artisan queue:work command to execute the queue.
But here in the documentation, the code is clear to consume the message but How to consume the message and execute the same with an artisan command is confusing.
where would I write the code below code in Laravel application and listen to it in production server:
Amqp::consume('queue-name', function ($message, $resolver) {
var_dump($message->body);
$resolver->acknowledge($message);
});
For now, am consuming the message from the queue in the AppServiceProvider.php file boot() method. But not sure whether it is the correct way to follow.
The way to consume messages is to create a custom artisan command to listen to the queue. We need to run the command and handle the keep alive ourselves as the package does not provide any boilerplate for the same. The connection can be kept alive by making the param Persistent to true in the configuration.

Laravel Queue Timeout Error

I am creating Laravel Jobs for sending emails and add them in Laravel Queue. Everything works fine, but the timeout of laravel queue is 300 seconds. How can I extend this time? Or I want to run this queue listen forever because anytime mails can be send due to user interaction. Any one can help?
To run a queue listener in the background, you need to configure it via Supervisor which is a process monitor for Linux. You can even assign the number of workers using this.
To configure the timeout, you can use the option timeout in the queue:listen command. The command will be:
php artisan queue:listen --timeout=500
The best way, You need separate data by page push to queue, instead of 1 queue large data, we have many queues waiting run backgrounds, if in you increase speed, you can make multiple jobs cath queue

How can I figure out why a Laravel Queue Worker is running?

A Laravel queue worker was producing a lot of error log entries due to the DB server crashing, in turn Laravel's log grew to 150gb within just two hours, filling up the entire hard drive so that several web apps stopped working.
But actually there is only a queue worker for sending emails in our system and no emails have been sent during the past days. So why is there still a queue worker running?
Are there other reasons why a queue worker might be accessing the DB in a Laravel system besides starting it "manually" (i.e. in our case - by the command that sends mails)?
We're currently using Laravel 5.1.
First, the Laravel worker is using DB to store its job details.
And, you should indicate the maximum number of times a job should be attempted using:
php artisan queue:listen connection-name --tries=3
Then setup a provider to handle if any queued job fails.
For your main question, you should install supervisor, then you can have a UI to manage your workers.

Beanstalkd running all jobs in the queue simultaneously on forge queue workers

I'm running an API build on Laravel Lumen 5.1, but I can't seem to get the Forge Queue Worker to work properly when using beanstalkd as a driver. It seems to run all the jobs in the queue simultaneously
I'm using the Forge UI to set up the driver
Queue Worker setup
And the .env drivers
The .env drivers
The queue system works fine when running it manually without any worker processing it.
If you need any more informations to help me, please just ask!
The purpose of the message queue is to allow parallel processing. If you have more workers eg: more threads than it will run simultaneously as many jobs.
In order to achieve non simultaneously that is counter intuitive and against the message queue principle. You can achieve that with 1 single worker, but it's not recommended as you don't leverage the power and scalability.

Resources