Comments (3)
Hi,
I would suggest map'ing a deserialize function across the sequence of messages- this would take a byte array and return a Clojure data structure.
We've used Cheshire, then you probably want something like:
(let [ms (messages consumer topic)]
(map (fn [{:keys [value]}] (parse-json (String. value))) ms)
from clj-kafka.
The Kafka consumer has support for defining serializers etc. but given messages are just sequences I'd stick with the regular Clojure functions.
Hope that helps, let me know if that doesn't solve the problem you have.
Paul
from clj-kafka.
Thanks @pingles i'll check this in the next few days.
One last question, if you are using Riemann - can you tell me how can I create event from the mapping above and index that?
Thanks!
from clj-kafka.
Related Issues (20)
- data.json vs cheshire HOT 1
- README.md New Producer example error
- clj-kafka.new.producer/producer code error HOT 1
- release 0.3.2 HOT 1
- Expose with-test-broker? HOT 1
- Make test helpers available HOT 1
- Readme port numbers.
- Offset management HOT 6
- Implement new KafkaConsumer
- Add more options to `messages` method for simple consumer HOT 4
- Update to Kafka 0.9 HOT 11
- I cannot get messages using clj-kafka.consumer.zk HOT 2
- fetch-consumer-offsets returning error HOT 3
- new producer send callback not invoked HOT 2
- Any reason for an old Clojure dep?
- Does this breaks with clojure 1.8? HOT 4
- [doc] Request for a CHANGELOG
- Upgrade for newer Kafka Versions HOT 1
- how to handle zk disconnect
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 clj-kafka.