jon-esperanza / silk-engine

Simple library for event processing with Kafka. Built on top of KafkaJS and inspired by Robinhood's Faust. Will be moved to Scala soon.
MIT License
0 stars 0 forks source link

Parsing and validation of message.key only works for numerical keys #8

Open jon-esperanza opened 2 years ago

jon-esperanza commented 2 years ago

Expected Behavior

Parsing and validation of message.key should work for string and avro? data types.

Current Behavior

If the message key is of string data type, the application parses it into a string incorrectly. A message key "bookOrdered" is parsed into "//"bookOrdered"".

Possible Solution

I believe a possible solution could be to figure out how to properly parse bytes/Buffer to a string. The data type of a KafkaMessage by KafkaJS allows it to be Buffer | undefined, so this might be an issue as well.

Necessity

We want to provide users with flexibility to use strings or avro? data types as their message keys and let us handle the ambiguity of parsing and validating it.