Search This Blog

Saturday, July 5, 2025

Q26-Q30

Q26. What is aggregator Design pattern?
Q27: what is the difference between orchestration and choreography in microservices architecture
Q28: 
-----------------------------------------------------------------------------------------------------------------------------
Q26. What is aggregator Design pattern?

Answer:
The Aggregator Design Pattern in microservices is a structural pattern used when you need to gather data from multiple microservices and present it as a unified response.

Keyconcepts:
1. The Aggregator Design Pattern usually implemented with API Gateway or BFF (Backend for Frontend) Patterns. 
2. Create a BFF or Aggregator Service using Azure Functions or Azure API App as an Aggregator Microservice. Use Azure Logic Apps (Low-code Option) as well. 

-----------------------------------------------------------------------------------------------------------------------------
Q27: what is the difference between orchestration and choreography in microservices architecture

Answer:

Aspect Orchestration Choreography
Definition A central service (orchestrator) controls the interactions and flow between microservices. Each microservice reacts to events and decides what to do, with no central controller.
Control Flow Centralized — one service knows and manages the process steps. Decentralized — each service decides its behavior based on events.
Analogy Conductor leading an orchestra. Dancers responding to the rhythm individually in a flash mob.
Coupling More tightly coupled — the orchestrator needs to know all participating services. Loosely coupled — services publish/subscribe to events without knowing each other.
Communication Pattern Often synchronous (REST calls, workflows). Asynchronous (event-driven: e.g., Kafka, Azure Event Grid, RabbitMQ).
Tools Azure Durable Functions, AWS Step Functions, Netflix Conductor, Camunda. Kafka, Azure Event Grid, NATS, RabbitMQ.
Visibility Easier to trace and monitor (central point of control). Harder to trace (distributed decisions and flows).



Use Orchestration When... Use Choreography When...
Business process is complex and needs strict control. You want highly decoupled, event-driven architecture.
You need a clear view of the flow and error handling. Scalability and independence of services are top priority.
Easier debugging/tracking is important. The system must evolve flexibly over time.

-----------------------------------------------------------------------------------------------------------------------------




-----------------------------------------------------------------------------------------------------------------------------



-----------------------------------------------------------------------------------------------------------------------------

Wednesday, July 2, 2025

Q21-Q25

Q21: Define Event Sourcing Architecture Design pattern? [Microservice Architecture Design patterns -- Database per Microservice, Event Sourcing, CQRS, Saga, BFF, API Gateway, Strangler, Circuit Breaker, Externalized Configuration, Consumer-Driven Contract Tracing]
Q22: Define Saga Architecture Design pattern
Q23: What is BFF ( Backend for Frontend) Architecture Design pattern?
Q24: What is API GateWay Architecture Design pattern?
Q25: Difference between Reverse proxy and Forward Proxy service/ Layer?
----------------------------------------------------------------------------------------------------------------------------
Q21: Define Event Sourcing Architecture Design pattern

Answer:
Here in this pattern Instead of storing the current state/ Final state of an object in database, Event Sourcing persists all events that occur in the application, allowing the state of the object to be reconstructed at any point in time.

In this pattern, every state change in the application is captured as an event and stored as a log of events. The state of the application can be reconstructed by replaying these events. This means that Event Sourcing provides an audit log of all changes that occur in the application.
For example, consider an e-commerce application. When a user places an order, an OrderPlaced event is generated and stored in the log. When the order is shipped, a ShipmentMade event is generated and stored in the log.
If the order is canceled, a OrderCanceled event is generated and stored in the log. By replaying the events, the current state of the order can be determined.


----------------------------------------------------------------------------------------------------------------------------
Q22: Define Saga Architecture Design pattern

Answer:
The Saga pattern provides a way to manage transactions that involve multiple microservices. It is used to ensure that a series of transactions across multiple services are completed successfully, and if not, to roll back or undo all changes that have been made up to that point.

Advantage of using SAGA 
1. Can be used to maintain the data consistency across multiple services without tight coupling.

The disadvantage of using SAGA
Complexity of the SAGA design pattern is high from the programmer's point of view and developers are not well accustomed to writing sagas as traditional transactions.
----------------------------------------------------------------------------------------------------------------------------
Q23: What is BFF ( Backend for Frontend) Architecture Design pattern?

Answer:
Backends for Frontends (BFF) is a design pattern used in microservice architecture to handle the complexity of client-server communication in the context of multiple user interfaces. It suggests having a separate back-end service for each frontend to handle the specific needs of that interface.
This allows developers to optimize the data flow, caching, and authentication mechanisms for the unique needs of the front-end while keeping the back-end services modular and decoupled.
For example, suppose you have a web application and a mobile application that need to access the same set of services. In this case, you can create separate back-end services for each application, each optimized for the specific platform.
The web application back-end can handle large amounts of data for faster loading, while the mobile application back-end can optimize for lower latency and network usage.

----------------------------------------------------------------------------------------------------------------------------
Q24: What is API GateWay Architecture Design pattern?

Answer:
The API Gateway Pattern is another common design pattern used in microservices architecture that involves an API gateway, which acts as an entry point for all incoming API requests. It provides a single point of entry for all the microservices and acts as a proxy between the clients and the microservices, routing requests to the appropriate service.
The main purpose of an API gateway is to decouple the clients from the microservices, abstracting the complexity of the system behind a simplified and consistent API. This also means that you don’t need to find and remember address of 100+ Microservice REST APIs.

----------------------------------------------------------------------------------------------------------------------------
Q25: Difference between Reverse proxy and Forward Proxy service/ Layer?

Answer:
Diagram

Description automatically generated
----------------------------------------------------------------------------------------------------------------------------

Q31-Q35

Q31: What is pods and how it is related to Docker images and Docker containers? Q32: What is the use of Compose Docker file? Q33. What are t...