Hello, I am making an application where it is accessing data from an open API and send it as notifications to my telegram bot.
Now, i have to call the API after every certain amount of intervals for the update. For which laravel task scheduling. Now, i am confused whether i use scheduling artisan commands or queued jobs ??
Its just a simple application where i call the API , see the update and send it to the telegram bot. So, which one will better and which one will be best when i will deploy my application to AWS.
Please tell me!
I think you should go with task scheduling because it simpler, no need to run supervisord to process queue job just your task and one time cron setup and you good.
I have apps calling 3rd party api using scheduling + cron and also deployed them on AWS, They work fine.
You should use queue when you want to improve UX such as, Admin send on demand message to multiple users via chat-bot.
So you can response to the Admin immediately after they summit the message and then the queue start to sending message right after that and you get a retry for free if something went wrong.
Based on your query what I am foreseeing is if your application is accessing the API based on some manual task or after some action then better use Queues.
You could use CronJob but just think if the application in the future makes too many requests or interacts with the API much then calling it via CronJob and looping over some resources is not that good.
On the other hand, if you had used Queues then even with too much load or too many API requests to notify you will be handle seamlessly.
End of the day makes sure to think of the future perspective too.