Lädt...


🔧 Event-Driven AWS: Implementing Choreography Pattern


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Definition

In Choreography, there is no central controller. Each service knows what to do and when to do it based on events. Services communicate with each other by emitting and responding to events, acting independently. The workflow emerges as a result of these independent actions, with no single service having visibility or control over the entire process.

Key Concepts of the Choreography Pattern

  • Decoupling Services: EventBridge enables different services to react to events without needing direct connections between them.
  • Scalability: Services only process events relevant to them, and EventBridge automatically scales to handle a large number of events.
  • Flexible Routing: You can set up rules that route events to specific targets based on event content.
  • Centralized Event Bus: EventBridge can aggregate events from multiple sources, making it easy to manage complex workflows.

Use Case

In this scenario, we follow the flow of an aicraft booking using the Choreography with EventBridge :

Choreography Pattern

Services

  1. Booking Service: Handles customer flight bookings and creates events like BookingCreated.
  2. Payment Service: Processes payments and emits events like PaymentConfirmed or PaymentFailed.
  3. Seat Assignment Service: Assigns seats to customers based on availability and preferences.
  4. Ticket Service: Issues tickets after payment is confirmed.
  5. Amazon SES Notification: Sends confirmation emails or SMS messages to customers.

Event-Driven Flow using EventBridge

  1. Booking Created:
    • The Booking Service creates a new flight booking and publishes a BookingCreated event to EventBridge.
  2. Payment Processing:
    • The Payment Service listens for the BookingCreated event on EventBridge.
    • Once the payment is processed, the service emits a PaymentConfirmed event (or a PaymentFailed event if payment fails).
  3. Seat Assignment:
    • The Seat Assignment Service listens for the PaymentConfirmed event and assigns a seat to the customer.
    • After a seat is assigned, it may emit a SeatAssigned event.
  4. Ticket:
    • The Ticket Service listens for the SeatAssigned event. Once payment is confirmed, the service issues a ticket to the customer.
    • After the ticket is issued, the Ticket Service emits an event to the Amazon SES Notification.
  5. Notifications:
    • The SES Notification receive the event and sends appropriate notifications (emails) to the customer.

EventBridge Failover Behavior

When Amazon EventBridge fails to invoke a target, it offers several mechanisms to handle such failures effectively:

  • Retries: EventBridge will automatically retry sending the event to the target based on the retry policy set for the rule (e.g. The number of retry attempts, the delay between retries, The maximum time) before treating the event as a permanent failure.
  • Dead Letter Queue (DLQ): If an event can't be delivered after the configured retry attempts, EventBridge will send the event to a Dead Letter Queue (DLQ). You can use an Amazon SQS queue or an Amazon SNS topic as the DLQ to capture failed events for further analysis.
  • FailedInvocations Metric: EventBridge tracks failed invocations through the FailedInvocations metric in Amazon CloudWatch. This helps you monitor and troubleshoot issues related to event delivery.
  • EventBridge Stops Trying: If 24 hours have passed since the first attempt to deliver an event and the target hasn't processed it, EventBridge will stop retrying. At this point, the event is marked as a permanent failure.

Conclusion

In conclusion, the Choreography Pattern on AWS, where independent services communicate through events using Amazon EventBridge. Each service reacts to events without centralized control, enabling flexibility, scalability, and decoupling. It describes a real-world use case of flight booking, with services like booking, payment, seat assignment, and ticketing all emitting and responding to specific events. The process flows seamlessly, with notifications sent to customers via SES after key events like payment confirmation and seat assignment.

...

🔧 Implementing Chain of Responsibility Pattern in C# : Middleware's Design Pattern


📈 32.18 Punkte
🔧 Programmierung

🔧 Choreography vs. Orchestration in Microservices: What’s the Right Choice?


📈 30.16 Punkte
🔧 Programmierung

🔧 Orchestration vs. Choreography: Understanding Two Approaches in System Integration


📈 30.16 Punkte
🔧 Programmierung

🔧 Day 15: Crafting Cars in Rust – A Symphony of Geeky Dialogues and Struct Choreography 🚗🛠️


📈 30.16 Punkte
🔧 Programmierung

🔧 Enhancing Resiliency: Implementing the Circuit Breaker Pattern for Strong Serverless Architecture on AWS


📈 27.24 Punkte
🔧 Programmierung

📰 Get started quickly with AWS Trainium and AWS Inferentia using AWS Neuron DLAMI and AWS Neuron DLC


📈 23.37 Punkte
🔧 AI Nachrichten

🔧 Design Pattern #6 - Composite Pattern


📈 21.55 Punkte
🔧 Programmierung

🔧 C# Pattern Matching Inside Out: Kompakter und prägnanter C#-Code durch Pattern Matching


📈 21.55 Punkte
🔧 Programmierung

🔧 Service: O pattern que virou anti-pattern


📈 21.55 Punkte
🔧 Programmierung

🐧 Factory Pattern: Alle Informationen zum Factory Method Pattern


📈 21.55 Punkte
🐧 Server

🔧 Design Pattern #5 - Adapter Pattern


📈 21.55 Punkte
🔧 Programmierung

🐧 Observer Pattern: Was steckt hinter dem Observer Design Pattern?


📈 21.55 Punkte
🐧 Server

🔧 Pub/Sub pattern vs Observer Pattern: what's the difference?


📈 21.55 Punkte
🔧 Programmierung

🔧 Module-Pattern | Javascript Design Pattern Simplified | Part 4


📈 21.55 Punkte
🔧 Programmierung

⚠️ [dos] Pdfium - Out-of-Bounds Read with Shading Pattern Backed by Pattern Colorspace


📈 21.55 Punkte
⚠️ PoC

🔧 Decorator-Pattern | Javascript Design Pattern Simplified | Part 5


📈 21.55 Punkte
🔧 Programmierung

🔧 Factory-Pattern | Javascript Design Pattern Simplified | Part 2


📈 21.55 Punkte
🔧 Programmierung

🔧 Observer-Pattern | Javascript Design Pattern Simplified | Part 3


📈 21.55 Punkte
🔧 Programmierung

🔧 Singleton-Pattern | Javascript Design Pattern Simplified | Part 1


📈 21.55 Punkte
🔧 Programmierung

🔧 Design Pattern #4 - Publisher/Subscriber Pattern


📈 21.55 Punkte
🔧 Programmierung

🔧 Design Pattern #3 - Observer Pattern


📈 21.55 Punkte
🔧 Programmierung

🔧 Design Pattern #2 - Facade Pattern


📈 21.55 Punkte
🔧 Programmierung

🔧 Go program pattern 01: Functional Options Pattern


📈 21.55 Punkte
🔧 Programmierung

🔧 Webkul pattern question advance pattern for interview with python


📈 21.55 Punkte
🔧 Programmierung

🔧 A transição do Higher-Order Component pattern para o React Hooks pattern


📈 21.55 Punkte
🔧 Programmierung

🔧 Design Pattern #7 - Builder Pattern


📈 21.55 Punkte
🔧 Programmierung

📰 Neu in .NET 7 [5]: List Pattern und Slice Pattern mit C# 11


📈 21.55 Punkte
📰 IT Nachrichten

🔧 Implementing a Database Helper in C# Using the Strategy Design Pattern Step-by-Step Guide


📈 21.4 Punkte
🔧 Programmierung

🔧 Implementing Thread Safe Singleton Pattern in C#


📈 21.4 Punkte
🔧 Programmierung

🔧 Building Resilient Microservices: Implementing the Circuit Breaker Pattern with Spring Boot and Hystrix


📈 21.4 Punkte
🔧 Programmierung

🔧 Understanding and Implementing the Repository Pattern in .NET


📈 21.4 Punkte
🔧 Programmierung

🔧 Implementing the Cached Repository Pattern in C#


📈 21.4 Punkte
🔧 Programmierung

matomo