.NET Architecture Weekly #6

Introduction

.NET Architecture Weekly is a journal about learning software architecture on .NET and not just limited* to .NET only.
PS: Why? Because software architecture designs normally can use in any languages or frameworks :).

Week #6

1) Microservices Architecture Design Patterns – Part 4

XII) Asynchronous Messaging Pattern

If we use a pattern such as Chain of Responsibility, the process tends to be blocked after we send a request since we need to wait for response. This issue can be solved using the Asynchronous Messaging Pattern since it makes a request to Event Bus or Queue that does not wait for an immediate response.

---
title: Asynchronous Messaging Pattern
---
graph LR
    UP[User Profile Service] --> |User Update Event| EB[(Event Bus / Queue)]
    EB --> |User Updated Event| B[Basket Service]
    EB --> |User Updated Event| O[Ordering Service]

    style UP fill:#f9d0c4 
    style EB fill:#f0b37e 
    style B fill:#a9dc76 
    style O fill:#a9dc76 

XIII) Shared Database Anti-Pattern

Shared Database Pattern in microservices architecture is considered an anti-pattern since microservices get intertangled and both will depend on a single database. But it does have some advantages if you need to have a better transaction control.

---
title: Shared Database Anti-Pattern
---
graph LR
    UI[Browser] -->|HTTP request| GW[API Gateway]
    GW -->|REST call| US[User Service]
    GW -->|REST call| TS[Task Service]
    GW -->|REST call| NS[Notification Service]
    US -->|DB call| DB[(Database)]
    TS -->|DB call| DB
    NS -->|DB call| DB

    style US fill:#f9d0c4 
    style TS fill:#f0b37e 
    style NS fill:#a9dc76

XIV) Decomposition Pattern

Decomposition pattern just like the name, it can use to decompose a monolith application to microservices such as by business capability, subdomain, or bounded context.

---
title: Decomposition Pattern
---
graph LR
    subgraph Monolith Todo App
        UM[User Module]
        TM[Task Module]
        NM[Notification Module]
    end

    subgraph Todo Microservices
        UM --> US[User Service]
        TM --> TS[Task Service]
        NM --> NS[Notification Service]
    end

    style US fill:#f9d0c4 
    style TS fill:#f0b37e 
    style NS fill:#a9dc76

These three patterns for this week mark the end of microservices notes. Next time we will try to explore other things on .NET architectures :).

Reference:
https://learn.microsoft.com/en-us/dotnet/architecture/microservices/architect-microservice-container-applications/asynchronous-message-based-communication

Microservices Decomposition Design Patterns

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.