Blizzard / Blizzard/node-rdkafka
Proposal: Implement transformation middleware
- Dominant language
- JavaScript
- Stars
- 2.2k
- Forks
- 403
- PR merge metrics
- No merged PRs in 30d
Description
When implementing [kafka-avro](https://github.com/waldophotos/kafka-avro) I resorted to hacking `node-rdkafka` so I could intercept Produced and Consumed messages and encode or decode them using the appropriate avro schema.
I wanted to know if I put the effort to design and spec with your approval and implement a middleware transformation pattern for all Producing and Consuming methods, if you would accept such a pull request.
The idea is to provide a method for end-users or libraries to be able to transform a message before it will be actually produced or consumed. Something like:
```js
consumer.transform(function(message) {
message.id = message.uuid;
return message;
});
```
The `transform()` methods would accept multiple calls and would serially store the middleware to be consecutively executed. It could also be asynchronous if the value returned is a promise.
What do you think?
Contributor guide
Assessment
This issue has not been assessed yet.