Should I Use Laravel Queues With Ajax For Sending Bulk Emails?

I am developing a Laravel application that uses ajax in making requests. This application needs to send bulk emails. I have read the documentation on Queues and understand basically that it'll help run jobs at the background. What practice do you think will be best?

  • Should I send the emails via an ajax request while not freezing the user?
  • Should I use Laravel Queues alone?
  • Should I combine both?

My current thought:

  • If I use just Queues I might face difficulties updating the user on the progress of the task.

1 answer

  • answered 2020-08-07 03:58 Digvijay

    I recommend to use queues whenever you are performing bulk actions like sending emails, sms, notifications, etc. This will better your user experience since they won't have to wait (freeze screen) and move onto other tasks.

    • Should I send the emails via an ajax request while not freezing the user?
      Yes

    • If I use just Queues I might face difficulties updating the user on the progress of the task.
      That is correct. You won't be able to show progress. Rather you can show appropriate message to the user like 'emails sent successfully' and let the queue jobs do the rest of the tasks for you.