I have a function in which builder users will post list a tender once a tender is posted all vendors who have subscribed for the particular category should get mail and sms. Now I am getting email and sms but it is taking long time to completed the process, so can any one help?
How can I create a background queue process which will execute all email and sms process after user get redirect to home listing page?
Separate the two concerns into two different applications:
The web application simply saves the messages to a database. Once the messages are saved (which is a fairly quick operation), the user can be redirected and can continue using the web application. Simply telling the user that the messages have been "queued" should be sufficient as an indicator of success at this time.
The console script simply reads from the database and sends the messages. With each one it would of course want to update that record in the database to indicate that it's been sent. (Or delete it entirely, depending on whether or not you want to keep a record of queued messages. Or update the record with some error information if the message fails so you can respond to failed attempts at a later time.)
Then just schedule the console script (likely with cron
or something similar) to run periodically. Every few minutes? Every hour? Every day? That's up to you. All it does when it runs is check the database for new queued messages and send them.