I have to send email to 10 users in my app but I have to send them email separately . I am using loopback framework and for sending email and rsmq
library
I have two approaches in mind for sending email
Approach 1
I should pass an array of emails to one message in the queue producer and in the queue listener I should iterate that array of email and send email one by one
Approach 2
I should pass separate message in the queue producer for every user to send email
Which approach is better and why ?
In Message Queuing, it is good to send one processable entry as one message to queue.
Reason Why:
Reason Why Not:
In case of batch processing, you may need to maintain no of emails per message and it exceed you need to write logic to split into batchee
Failure in processing of one message in middle may fail sending the rest of emails in same message.