https://github.com/rads/kafka.transit
🚄 Tools for using Transit with Kafka
https://github.com/rads/kafka.transit
clojure kafka transit
Last synced: 5 months ago
JSON representation
🚄 Tools for using Transit with Kafka
- Host: GitHub
- URL: https://github.com/rads/kafka.transit
- Owner: rads
- License: mit
- Created: 2017-05-23T06:59:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-02T03:10:07.000Z (over 8 years ago)
- Last Synced: 2024-11-28T18:10:21.400Z (about 1 year ago)
- Topics: clojure, kafka, transit
- Language: Clojure
- Homepage:
- Size: 14.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# kafka.transit
Tools for using Transit with Kafka.
- [Library](#library)
* [Installation](#installation)
* [Usage](#usage)
- [Command-Line Tools](#command-line-tools)
* [Installation](#installation-1)
* [Usage](#usage-1)
## Library
### Installation
To use the Transit serde, add this library as a dependency to your project:
```clojure
[rads/kafka.transit "0.3.0"]
```
### Usage
```clojure
(ns kafka-transit-example
(:import
(java.util Properties)
(org.apache.kafka.streams StreamsConfig KafkaStreams)
(org.apache.kafka.streams.kstream KStreamBuilder)
(rads.kafka.transit MsgpackSerde)))
(def props
(doto (Properties.)
(.put StreamsConfig/KEY_SERDE_CLASS_CONFIG MsgpackSerde)
(.put StreamsConfig/VALUE_SERDE_CLASS_CONFIG MsgpackSerde)))
(def builder (KStreamBuilder.))
(.start (KafkaStreams. builder props))
```
## Command-Line Tools
### Installation
To use the command-line tools clone the Git repository to your local machine:
```shell
git clone git@github.com:rads/kafka.transit.git ~/lib/kafka.transit
cd ~/lib/kafka.transit
```
Now the scripts are available at `bin/`. For convenience you can create symlinks to these scripts or add `bin/` to your `$PATH`.
### Usage
These scripts are just like the default console producer and consumers except they use Transit for serialization instead of Avro or JSON.
```shell
# Produce to a Transit topic
bin/kafka-transit-console-producer --zookeeper localhost:2181 --topic transit-test
# Consume from a Transit topic
bin/kafka-transit-console-consumer --bootstrap-server localhost:9092 --topic transit-test --from-beginning
```