Hi all,
At work, we have written a micro service which provides a REST API for project creation. It is basically a CRUD wrapper on a DB table. It has its own DB table which it manages, but needs to make some calls to a satellite system whenever it modifies a line in that table. This makes is already pretty large.
We want to add new functionality: the same micro service should be able to run in API mode, where it exposes its rest API, but also in command line mode.
In command line mode, running it makes it send an “delete notification email” to the owner of each project which is about to expire in 12, 6 or 1 days. If I run it with a certain flag it will only send one email to a single project.
To achieve this “delete notification email” functionality, I query for the projects which are about to expire, email their owner, and if any such email fails to be sent, I make a call to another satellite system.
Does it make sense to have one micro service for the rest API, which does mainly CRUD operations, and a separate microservice, which is triggered perriodically by a cronjob and does the email query and sending ?
Is there any benefit if we were to keep both functionality in a single, larger, micro service, and either call it in cli mode or API mode ?