Proposal: Implement message keys as bytes instead of strings #81
Description
This is rather a proposal for future versions, as it will be a breaking change.
The thing is that, message keys in Kafka are bytes, so can be not only simple strings, but also complex structures encoded as bytes.
For example we use Debezium (http://debezium.io) for doing Change Data Capture from MySQL databases, and Debezium uses table's primary key as message key for Kafka. It is commonly encoded with Avro as a struct like {"id": 1}
.
Right now in order to deal with this, we need to pass goka.UpdateCallback
everywhere, that would convert key string back to []byte
, deserialize it to struct and then store only the int value converted to string as a table's key.
Using []byte
for keys would just be more clear semantically for many Kafka users, since that is how Kafka works internally.