Comments (7)
Hi @rawkode, thanks for this suggestion!
I generally try to avoid adding pluggable functionality to do something that's already easily accessible. So in this case the value of a config-specified serializer seems low since it's not hard for implementers to know how or where to implement that functionality themselves (right there in the message handler!). Doing otherwise tends to just increase the framework's surface area for little real value. But that's purely from a feature management perspective. Perhaps there's value in having a few common serializer implementations already available?
Happy to hear others' thoughts!
/cc @sdball @objectuser
from kaffe.
@rwdaigle I'm now running 9 different services, all implementing the same piece of functionality. Perhaps I am in a minority with my usage. Although the setup is trivial, I do prefer not repeating myself 😄
from kaffe.
How about making your serializer logic into its own dependency via mix to be called from each handle_message
?
def handle_message(message) do
MyCustomMessageParser.parse!(message)
|> other_things
|> for_this_service
end
You'd still get consolidated parsing logic with minimal supporting code. But instead of one line of configuration you'd have one line of message handling code. That keeps Kaffe's contract simpler and keeps all the message handling logic out in the open.
from kaffe.
OK. I'm sensing you aren't keen on this idea 😂
I'll close it and work around it.
from kaffe.
Haha, sorry @rawkode!
I think this is a great use-case that forces us to be more explicit about the contract for Kaffe. In my mind it's a low-level Kafka library that handles much of the nuance associated with practical usage of Kafka. So one-level above a pure adapter (that's what brod is), but not itself a framework. It's more of a convenience library.
I think a good litmus test for this is that I don't ever see Kaffe concerning itself with actual message bodies (parsing, plucking values, etc...), as that starts to get into domain logic. Anything Kafka metadata related however, I would see as fair game.
Hopefully that sounds logical vs. just an arbitrary line that you happen to be on the other side of for this example?
from kaffe.
Unfortunately, that’s an unexpected approach for the Kafka community. The JVM libs and the librdkafka
family all expect producers/consumers to specify the serializer/deserializer as part of the config.
from kaffe.
Kaffe was designed to make its use and setup as trivial as possible. In this it’s more like ruby-kafka’s approach to serialization: https://github.com/zendesk/ruby-kafka/blob/master/README.md#serialization
from kaffe.
Related Issues (20)
- Defining multiple handlers HOT 1
- worker_per_topic_partition with multiple topics HOT 1
- Examples not compatible with Elixir 1.10 or 1.11 HOT 2
- extract_der is giving error with SSL HOT 2
- Undefined function exponential_backoff HOT 10
- Offset doesn't get updated between runs and runs crash with OOM errors HOT 4
- async ack - lots of duplicate messages until I restart the application HOT 2
- Kaffe.Producer.produce_sync raises on timeout
- How to set kafka headers when publishing message HOT 1
- Invalid call to raise/reraise on brod/kpro error
- Add support for SCRAM mechanism in SASL authentication. HOT 1
- Module to help write ExUnit tests
- It's impossible to create 2 separate consumers for different topics
- Running mix with kaffe deps fails to download pc package from hex
- Wrong place for configuration
- Config dump on error leaks credentials HOT 1
- Endpoints configuration is weird for using ENV vars
- Missing documentation HOT 8
- Connecting to a TLS-based Kafka instance under AWS MSK? HOT 18
- Receives notification when rebalance in progress/assignments revoked HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaffe.