I have developed a rest api which accepts some data and store it in a message queue (Redis List). Now from redis this data is pushed into MySQL database. The problem is client needs to wait till the data is written into mysql.
I want that the client should wait till the data is written into message queue (Redis List) and the function to push the data into MySQL should execute Asynchronously. How can I do it ? My entire code base is in PHP, So I would prefer it in PHP.
I have read this but havn't tried.
Distributed queue example in PHP using Redis
I have confusion that how slave.php ( mentioned in the link) will be executed. I mean When a new message arrives in the queue, how slave.php will find this.
I dont want to use cronjob for this. Instead when a new message arrives slave.php should get executed asynchronously. How to do it?