Kafka Event sourcing in Event Driven Architecture
Event Driven architecture

Kafka Event sourcing in Event Driven Architecture

What is Event Sourcing ?

Event Sourcing?is ensuring every change to the state of an application is captured in an event object, and that these event objects are themselves stored in the sequence they were applied for the same lifetime as the application state itself.

so instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data.

What is Event Driven Architecture ?

A microservice architecture is an architectural pattern that structures an application as a collection of small, loosely coupled services that operate together to achieve a common goal. Because microservices work independently, they can be added, removed, or upgraded without interfering with other applications.

An event-driven architecture?uses events to trigger and communicate between decoupled services?. An event is a change in state, or an update, like an item being placed in a shopping cart on an e-commerce website.

What is kafka echo system ?

Please have a look at :

Conencting the dots : Kafka echo system & Event sourcing

  • Simply , you can use Apache Kafka borker ! it maintains an immutable sequence of events that multiple applications can subscribe to so that Multiple producers can subscribe to multiple topics, and publish events to multiple partitions. on the other hand Consumers on the other hand are divided into consumer groups, consumers in the same consumer group can only read from different partitions. withing each topic , messages are guratnteed to e executed in order.
  • In more complex case , Producres can be a of other popular systems like ElasticSearch,PostgreSQL, BigQuery, MySQL.. etc .. Kafka Connect — a framework (APIs) and runtime for plugins that integrate Kafka with external systems.it can be deployed in two modes. either standalone mode or distributed mode.These Connectors come in : Source Connector — used when sourcing data from another system (the source) and writing it to Kafka. Sink Connector — used when sourcing data from Kafka and writing it to another system (the sink).

Long story short is that events to change state of the application is recorded to a db for example ,then a source connector add it to a topic on Kafka topic to be consumed later to communicate with other microservices .

No alt text provided for this image
Kafka connect & apache kafka in event sourcing model

Conencting the dots : Kafka echo system & Event driven Architecture

For the decoupled microservices . Instead of checking for new data, micor services just listen to a certain event and take action.

decoupled microservices here are the consumers of the Apache kafka topics

unlike messaging-oriented systems, events published in Kafka are not removed as soon as they are consumed. They are removed once a specific amount of time has passed.

Conencting the dots : Why Kafka ?

  1. Durable, Persistent Storage
  2. Scalability
  3. High performance

Use case : Uber - One of the Largest Kafka Deployments in the World

No alt text provided for this image
Kafka At Uber

Refrences :

[1] https://dzone.com/articles/microservices-event-driven-architecture-and-kafka

[2] https://hevodata.com/learn/kafka-event-driven-architecture/

[3] https://nexocode.com/blog/posts/event-driven-architecture-examples-in-logistics-apache-kafka-to-handle-supply-chain-network/

[4] https://learn.microsoft.com/en-us/azure/architecture/guide/architecture-styles/event-driven

要查看或添加评论,请登录

Marwa Ali的更多文章

  • Spring Security 6 with Spring Boot 3 + KeyCloak

    Spring Security 6 with Spring Boot 3 + KeyCloak

    What is KeyCloak ? KeyCloak Open Source Identity and Access Management.It provides user federation, strong…

    1 条评论
  • Spring Security 6 with Spring Boot 3 + JWT

    Spring Security 6 with Spring Boot 3 + JWT

    In continuation to my article Spring security 6 and spring boot 3 , Next introducing JWT token. Learn Jwt token here .

  • Spring Security 6 with Spring Boot 3

    Spring Security 6 with Spring Boot 3

    Say goodbye to Old security , Say Hi to Spring Security 6 with Spring Boot 3 . it is easier and simpler.

  • SpringBoot batch framework

    SpringBoot batch framework

    Spring Batch is a lightweight, comprehensive batch framework designed to enable the development of robust batch…

  • Dockerizing Springboot Application

    Dockerizing Springboot Application

    Docker is a powerful tool that allows developers to package their applications into containers that can be easily…

  • Istio addons

    Istio addons

    #devops #istio #grafana #promtheus #servicemesh Please see my previous artcile at Grafana An open source monitoring…

  • Istio service mesh

    Istio service mesh

    #devops #kubernets #istio #servicemesh What is a service mesh? Developers and operators face chanllenges with a…

  • Springboot Distributed State Machine

    Springboot Distributed State Machine

    #statemachine What is a distributed state? An application may exist in a finite number of states. when something…

  • Microservices Saga Pattern with Spring State machine

    Microservices Saga Pattern with Spring State machine

    What are sagas in microservices ? A database-per-microservice model provides many benefits for microservices…

  • SpringBoot State machine

    SpringBoot State machine

    The concept of a state machine is most likely older than any reader of this reference documentation and definitely…

社区洞察

其他会员也浏览了