shiv455
shiv455

Reputation: 7774

Event vs Topic Apache Kafka

Sorry this may be a basic question trying to understand the difference between an event and topic in Apache Kafka.

My understanding is both are same and in streaming context topic is called as Event. Correct me if I am wrong.

Upvotes: 9

Views: 10499

Answers (3)

Sivaram Rasathurai
Sivaram Rasathurai

Reputation: 6363

A Brief Introduction to Events and Topics

I just wanna to give my knowledge on this.

Events

Events are normally means something happened which means object state changes refer to events. My room temperature is 35c and it is changed to 37c then there is a temperature change event that happens. So This says There are a lot of events in the world. like as below.

enter image description here

There are a lot of events are happening in the world.

Topic

As I said there are a lot of events happening in the world. We need to organise/ categories them. Here the topic comes to play. A topic is simply used to group some events with their nature. Just Illustrate the below scenario, In our system customers can order products. All the events are to this action can be categorised into an `**order**` topic. There are no issues in duplication events between topics. so for example from this order topic event. We can filter specific geolocation order events to separate topics. like **Srilanka-order**.

Topics can be related to a table in the database but not exactly and events can be related to records of the database.

enter image description here

Upvotes: 4

ppatierno
ppatierno

Reputation: 10065

What is called "event" in the streaming context (if we speak about Kafka Streams API) is a "message" in the normal Kafka usage. The topic is the place where you store messages (or events, in streaming context).

Upvotes: 10

Abhishek
Abhishek

Reputation: 1225

Event (the data) is something you would store in a Topic e.g. userA updated his profile - this is an event and you can send this across (in any format e.g. a JSON payload) to a Kafka topic. Both are not same - no matter what the context

Upvotes: 5

Related Questions