lorisleiva / laravel-actions

⚡️ Laravel components that take care of one specific task
https://laravelactions.com
MIT License
2.41k stars 117 forks source link

Asynchronous listeners #227

Open khalyomede opened 1 year ago

khalyomede commented 1 year ago

Hello, congratulations for your package! I have searched to make an action (as listener) asynchronous but wasn't able to find any resource around that.

Is it possible?

edalzell commented 1 year ago

Do you mean like put in on the queue?

khalyomede commented 1 year ago

Exactly, seems like adding implements ShouldQueue was sufficient enough, but just wanted to make sure since it is not precised in the doc

edalzell commented 1 year ago

Exactly, seems like adding implements ShouldQueue was sufficient enough, but just wanted to make sure since it is not precised in the doc

Ya the docs could use an update, for sure. I'm hoping to PR that in a bit.

edalzell commented 1 year ago

There we go: https://github.com/lorisleiva/laravel-actions-docs/pull/48

Casmo commented 1 year ago

If your action is running as listener on queue. The variables $jobTries etc do not work. You should use (the Laravel) $tries variable.