Kafka as an eventstore

Although we have already seen the CQRS implementation, I still feel that you may have a few queries related to eventstore, and how it works. That's why I'll take the use case of Kafka, which can be used as an eventstore for your application.

Kafka is, typically, a message broker or message queue (similar to RabbitMQ, JMS, and others).

As per the Kafka documentation, Event Sourcing is a style of application design where the state changes are logged as a time-ordered sequence of records. Kafka's support for very large stored log data makes it an excellent backend for an application built in this style.

For more information related to implementing Kafka, read its documentation at this link: https://kafka.apache.org/documentation/.

Kafka has the following basic components:

  • Producers: This sends messages to Kafka
  • Consumers: These subscribe to streams of messages in Kafka

 

Kafka works in the following manner:

  • Producers write messages in Kafka topics, which could be users
  • Every message that is in a Kafka topic is appended at the end of the partition
Kafka only supports write operations.
  • Partitions represent streams of events, and topics can be categorized into multiple topics
  • Partitions in topics are independent of each other
  • To avoid disaster, Kafka partitions are replicated across several machines
  • To consume Kafka messages, the client reads the message sequentially, starting from the offset, which is set in Kafka by the consumer
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.46.58