I am using ProtoBuf over Kafka. We are creating a lot of ProtoBuf messages, but we are stuck on these two options. Wondering what is the best way to do this? Hopefully question won't be downgraded as it is somehow opinion based!
Say, I want to send Employee message on Kafka. I want to use "id" as the kafka key and value as the "Employee" message as below.
Option - 1 includes "id". In this option, your entire object is in one place as a domain object.
message Employee {
string id;
string name;
string title;
}
Option - 2 doesn't include id - as it tries to use Kafka key (which we are populating with id) and let the consumer piece them together when they take a message out of Kafka?
message Employee {
string name;
string title;
}
Any suggestions on the pros and cons of these two and any known best practice? Thanks.