# How to design topics/messages correctly

**URL:** <https://forum.confluent.io/t/how-to-design-topics-messages-correctly/12366>\
**Category:** Stream Processing\
**Created:** [15 October 2024 13:05 UTC](https://forum.confluent.io/t/how-to-design-topics-messages-correctly/12366 "2024-10-15T13:05:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmarciano](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mmarciano](https://forum.confluent.io/u/mmarciano)\
**Post date:** [15 October 2024 13:05 UTC](https://forum.confluent.io/t/how-to-design-topics-messages-correctly/12366/1 "2024-10-15T13:05:55Z")

</div>

Hey folks, I have a question about how to “design” Kafka topics/messages.  
I am trying to find the correct balance.

Context first:

- SystemA - producer
  - There are entities (db tables) with relationship between them. For example, EntityA has multiple EntitiyB, and Entity B has a single EntitiyC and so on.

- SystemB/SystemC/… - consumers

Requirement:

- I want the SystemA to produce messages on each entity change (create/update/delete).
- The number of entities is small, and the changes frequently are also small. Let’s say thousands per year (probably much less than that)

I thought about the following:

- a dedicated topic per entity events, for example: `entitiyA.events` , `entityB.events` ,…
- Each topic with 1 partition
- The message will be JSON looks like:

```auto
{
	"id": UUID
	"type": "entitiyA:created"
	"sent_at": DATETIME
	"body": {
	    "id": 1687,
	    "foo": "bar",
	    ...
	    ...
	    ...
	    ...
	}
}

```

Questions:

- What do you think about the above design?
- I know there is the approach of a single topic for all the messages across all entities- is there a reason to do that over a dedicated topic per entity? It’s all about balance…

**Happy to hear your experienced thoughts**

---

<div class="post-metadata">

**Author:** ![Cerchie](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/cerchie/32/3978_2.png) [@Cerchie](https://forum.confluent.io/u/Cerchie)\
**Post date:** [18 October 2024 19:53 UTC](https://forum.confluent.io/t/how-to-design-topics-messages-correctly/12366/2 "2024-10-18T19:53:44Z")

</div>

Hey there! I agree with you about having a dedicated topic per events. Here’s a post I wrote that says more on this [“topic”](https://www.confluent.io/blog/kafka-consumer-group-partition-strategy/) haha. Happy to hear other weigh in on change data capture strategy as well and will keep an eye on this thread.
