Multithreading in Slim

Hi, I’m sure this much have been answer before but I’m still figuring out how to do multithreading task with Slim framework.

I have build a backend of a mobile app and in the code, I have some non essential tasks that can execute without the mobile apps waiting for the api request to complete.

What’s the best way to execute tasks like some functions in a background thread. I’m open to using some third party service but a little more details into that will be useful. My use scenario is: when a mobile app calls one of the api endpoint, the server fetches data from database and will return that data but before, it must call some other url and insert some data into database. These two tasks, calling url and inserting data, should be done without the mobile app having to wait for these two to finish and get a response from server.

I’m currently using Azure web app.

Thank you.

I would use queued jobs. Either with something like beanstalkd or I guess Amazon SQS. But for something specific I would just use a cron job with slim’s cli and a job queue table. I haven’t tried any multi-threading in such cases…

Edit: or this: Queues - Slim 4 Skeleton