Implementing Jobs and Queues for a certain module
I'd like to know if there're some special considerations in order to create a queueable job for an specific module.
This module does the following:
- A playlist is created.
- Upon creation, a
PlaylistWasCreatedevent is triggered and the playlist is sent to a TCP Port via sockets.
- This listener app on the other end, does some stuff with the playlist and when it finishes, it sends a message back to an API endpoint.
Between step 2 and 3 is where I want to implement the Queuing, as I want to get the user back to the Playlists index, and not making him to wait until the stuff that does the socket thing ends (it concatenates videos and this action can take a long time).
Should I follow the Laravel's vanilla approach to create the Job class? Or should I have in account anything special in order to do so? I haven't find any requirements or information in the PingpongSky documentation about it.
@zedee You should follow Laravels own documentation for this.
As far as i know Asgard has no specific helpers or anything else for this.
Even Asgard/Notification uses classical way of queuing.
This should be pretty straight forward, i believe you will have no difficulties.
Yes, I tried to do so following Laravel's documentation and it works that way indeed.
More than looking for a helper, I asked the question while doing it, just in case I had to do anything specific, being the app module based.
As @armababy pointed out, I also use the usual laravel way of handling it. Works as expected.
Hi, i need to create a job that handle specific module entities so i would like to create the job inside the module itself to be more clear, not in the main app/jobs folder, is there any way to do so?
Creating it in the main app/jobs would be very easy and straightforward with the artisan make:job command, but would breake the asgard modular approach so it would be a pity.
Nevermind, moving my job file to MyModule/Jobs keep working as espected.