M
M
Mokhirjon Naimov2015-11-17 20:09:28
Email
Mokhirjon Naimov, 2015-11-17 20:09:28

Why don't queues fire without artisan queue:listen command in LARAVEL?

I sent the account activation code to email via Queue. This should fire when a user registers on the site. Messages come (it works only) when I execute the command on the server artisan queue:listen. Yes, this is despite the fact that registrations made before this team do not come at all. Only those that are made when the command has already been executed come artisan queue:listen.
But shouldn't it work without artisan queue:listen?!
Moreover, in the terminal, when it is already running, it artisan queue:listenis entered (without stopping):

[Illuminate\Database\Eloquent\ModelNotFoundException]                
No query results for model [Cartalyst\Sentinel\Users\EloquentUser].

This is fine?
PS I just don't understand how queues work at all, but I really want to use new technologies (well, relatively for me :))
UPD: about errors in the terminal! I sent objects received from Sentinel and Activation (from the cartalys/sentinel package) to the queue , but it turns out that you can’t do this ...
In short, it was necessary to send only the user ID and through it they would receive the user data in the class. That is, in app/Jobs/SomeQueueClass.php(methods __consturct($user_id)and handle()).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Bilyk, 2015-11-17
@zvermafia

Yes, that's fine - that's how it's supposed to work.
The principle of the queue is as follows: you stuff your small tasks into the tube (tube, channel) (for example, sending soap to one user), at this time a process is hanging that listens to your tube and as soon as tasks appear in it, it starts processing them.
If your load is not large or you don't want to play with the queue - you can put "sync" as the driver - the message will go as usual.
If queues are needed, I recommend reading about daemonizing the listener process or about the supervisor
laravel.com/docs/5.1/queues#supervisor-configuration

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question