Mastering Development Software

Can a microservice contain multiple applications?

I am having trouble understanding if a microservice can contain multiple applications.

Looking at Microsoft’s example, the Ordering Microservice contains 2 applications.

  1. The API
  2. Background tasks

Looking at blog posts and other posts on this site, it seems that having multiple applications interacting with the same database is incorrect, however, I can understand that it can be useful.

Let’s take an example I am thinking of implementing for my work where we read emails and each attachment needs to be processed differently:

  1. Read emails from an inbox
  2. Save email attachments to a database for processing
  3. Publish "X" attachment received event
  4. "X" attachment service process the attachment and marks the attachment as processed.
    This would violate the single per service because all of the "Attachment Services" would be interacting with the same database. Is this ok because its working within the same domain?

Leave a Reply

Your email address will not be published. Required fields are marked *