How to integrate event-driven microservices with request-response APIs?
There are two types of external events:
Autonomously Generated Events (analytical events) Reactively Generated Events (events from request-reply) There are two approaches of processing and serving requests using stateful services:
using internal state stores (with silly or with smart routing) using external state stores (with regular or with composite microservice) Ways of handling requests within an event-driven workflow:
The 4th pattern to build microservices is to use Lightweight Frameworks.
Lightweight Frameworks provide similar functionality to Heavyweight Frameworks, but they heavily rely on:
the event broker the container management system (CMS) In many cases they exceed Heavyweight Frameworks.
Different apps can use any/different resources from the cluster which are better fit their needs. While still provide Scaling and Recovering from Failures (again by heavily relying on event broker and CMS).
Heavyweight Stream Processing Frameworks are another foundation/pattern to build your microservices.
These frameworks are highly scalable and allow you to efficiently solve many analytical tasks. But they are not always good for stateful event-driven microservice application patterns.
Heavyweight frameworks operate using centralized resource clusters, which may require additional operational overhead, monitoring, and coordination to integrate successfully into a microservice framework. However, recent innovations move these frameworks toward container management solutions (CMS) such as Kubernetes that should reduce your efforts.
Basic Producer and Consumer (BPC) is a simple pattern for creating microservices. It forms the foundation of stateless and stateful services.
You can use it for:
interfacing layer between event streams and legacy systems leverage external stream processing systems to augment capabilities. But it requires your extra effort for:
simple state materialization event scheduling timestamp-based decision making All of these is disclosed in the Chapter 10 of the book we are currently studying:
Function-as-a-Service (FaaS) is an area of cloud computing that is growing rapidly.
There are following issues to conside here:
Principles of FaaS Open source and 3rd party FaaS providers 4 components to consider when building microservices as functions Cold Start vs Warm Start Different Triggers that can start FaaS: Triggering Based on New Events, Triggering Based on Consumer Group Lag, Triggering on a Schedule, Triggering Using Webhooks, Triggering on Resource Events Maintaining State Two patterns of functions calling other functions: Event-driven and Direct-call Termination and Shutdown Tuning and Scaling All of these is disclosed in the Chapter 9 of the book we are currently studying:
There are two patterns of building event-driven microservices:
Choreography (without centralized coordination) Orchestration (with centralized coordination) Both have pros and cons (however what I’ve learnt is that Orchestration is a better pattern)
How to implement Distributed Transactions with Choreography and with Orchestration.
How to AVOID implementing Distributed Transactions - a Compensation Workflows approach.
All of these is disclosed in the Chapter 8 of the book we are currently studying:
Overviewing basics of event processing in Event-Driven Architectures:
Typical structure of microservice Typical types of event transformations, 2 branching scenarios, merging streams Repartitioning events and when it can be useful Copartitioning events and when it is needed Assigning Partitions to a Consumer Instance. Three strategies to do this. Recovering from stateless processing instance failures. These topics are disclosed in the Chapter 5 of the book we are currently studying:
Introduction into Event-driven microservice (EDM) architecture consists of the following topics:
two topologies content of events three types of events table-stream duality schemas for defining event data single writer principle features of event broker event broker vs message broker single source of truth principle scaling using containers and VMs microservice taxes that we should pay These topics are disclosed in the Chapter 2 of the book we are currently studying:
Our company’s books club has selected a book about Microservices. It is “Building Event-Driven Microservices: Leveraging Organizational Data at Scale” by Adam Bellemare
Chapter 1 contains intro info:
Types of architectures and differences between them:
Traditional monolith-style architectures Service-oriented architectures (SOAs) Event-driven microservice (EDM) architectures Levels of Communication Structures and related Conway’s Law:
business implementation data Problems with traditional architectures (monolith & SOA) when you need to: