Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Event-Driven Microservices Architecture: Reason...

Event-Driven Microservices Architecture: Reason, how and where to apply

During my journey in microservices, it became apparent that the REST standard has been widely used in communication between microservices for a long time. But recently event-driven integrations have started to invade its territory. It turns out that there are some good reasons for this.

In this lecture, I will present an introduction to the Event-Driven Microservices Architecture, its main characteristics and the reasons why large technology companies are adopting such a flexible, performative and scalable architecture.

Luram Archanjo

March 12, 2020
Tweet

More Decks by Luram Archanjo

Other Decks in Technology

Transcript

  1. Who am I? • Software Engineer at Sensedia ◦ Edenred

    ◦ Cielo • MBA in Java projects • Java and Microservice enthusiastic
  2. Moving to Microservices Feature A Feature B Feature C Monolith

    Microservice Microservice Microservices Microservice
  3. • Communication • Security • Network failures • Observability ◦

    Metrics ◦ Logs ◦ Tracing Challenges with Microservices
  4. REST - Representational State Transfer GET GET POST PUT DELETE

    /movies /movies/{movieId} /movies /movies/{movieId} /movies/{movieId}
  5. • Web already built on top of HTTP • Easy

    to understand • Variety of http implementation in any languages • Loose coupling between client and server Representational State Transfer
  6. Microservice Communication Microservice Microservice Microservice Microservice Microservice Some kind of

    problems • Crash of service • Slow response time • Change of interface
  7. Message-Driven Architecture Producer Consumer Message Broker Producer Producer Consumer Consumer

    Advantages • Durable Message • Guaranteed delivery • Decoupling
  8. Event-Driven Architecture Event Producer Event Consumer Event Broker Fire &

    Forget Pattern One event, many consumers! Event Consumer Event Consumer
  9. Types of events Low level event “CRUD” Events • OrderCreated

    • OrderUpdated • OrderDeleted Domain level event Business Events • RequestedOrder • ApprovedOrder • RejectedOrder
  10. Saga Pattern Orchestration Choreography Event Producer Event Mediator Event Consumer

    Event Consumer Event Event Broker Producer Consumer Event Consumer
  11. “We can query an application's state to find out the

    current state of the world, and this answers many questions. However there are times when we don't just want to see where we are, we also want to know how we got there.” Martin Fowler, 2005
  12. Event Sourcing Persists the state of a entity as a

    sequence of state-changing events Whenever state of entity changes, a new event is appended to the list of Events Saving an event is a single operation (atomic) The application reconstructs an entity’s current state by replaying the events
  13. CQRS Optimize different nonfunctional requirements for read and write Write

    Delay Eventual Consistency Database as event publisher (optional) Data Projection and Materialized View Command Service Microservice Event Store Query Service Microservice
  14. Event Ording 0 100 80 Events Account: Created Deposit: R$

    100 Withdraw: R$ 20 Withdraw: R$ 20 Ordering Not Ordering 60 0 0 0 100
  15. Event Stream Event #1 Event #2 Event #3 Event #4

    Event #5 Event #6 Event #7 Replay Timeline
  16. “By 2020, event-sourced, real-time situational awareness will be a required

    characteristic for 80% of digital business solutions, and 80% of new business ecosystems will require support for event processing.” Top 10 Strategic Technology Trends for 2018
  17. Summary 2º Place 1º Place 3º Place It enables an

    application to maintain data consistency across multiple services without using distributed transactions It scales well to a very large number of users and allows new services to be added without breaking the streams of data that are currently deployed Analytics • Audit • Near real time • Machine learn