I have a bulk emailing service within the system which allows for a template to be used. When the mail is sent the template is parsed or run through a parser to replace tags with actual information. i.e “[Foo] has logged in” is parsed to “Bar has logged in”
Is it better to have 1 service for sending and parsing emails (concurrently), or to have 2 services, one which only checks for pending emails and parses them, and another which only sends emails who have already been parsed?
1
There are two jobs to be done
- Preparing personalized mails based on a template and data-set
- Sending a mail to a recipient.
This asks for two services.
Because it is very common to do both jobs one immediately after the other, I would further arrange things such that the end-user only has to use one service:
- either a third (convenience) service that encapsulates the two above
- or the first service automatically invokes the second service
2
Unless I am missing some information I see no reason why you would need 2 services to do what you could do with 1. In fact, it may be easier to do it with one in case there are any resources they both share, could mean less code and/or memory used.
You could add more info to the question such as: What do you currently think would be the advantage to having 2 services instead of 1?
Then we can look at that and explain why 1 can handle that better, or we will see your reasoning and agree, yes you can’t do that with only 1 service, etc.
2