kafka-produce-scala-example
Extremely minimum example to use kafka producer in scala.
- kafka-1.0
- scala-2.12.4
Assumed
- broker :
localhost:9092
- topic :
test
- docker-compose
% docker-compose run sbt
Example Apps
src/main/scala
Produce01
: mimimum producer ("test", "1")Produce02
: idempotent producer ("test", "1")
ProduceXX
Run sbt:kafkaProducer> runMain Produce01
Run Consume
This is an easiest way to consume the last message in the topic test
.
% kafka-fetch test -l -g
test#0 226: (unknown) Bytes"1"
- kafka-fetch: https://github.com/maiha/kafka.cr
Contributing
- Fork it ( https://github.com/maiha/kafka-produce-scala-example/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- maiha maiha - creator, maintainer