Franz is a small Java written framework for establishing a multi-threaded microservice that is mainly based on apache kafka producers and consumers.
███████╗██████╗ █████╗ ███╗ ██╗███████╗
██╔════╝██╔══██╗██╔══██╗████╗ ██║╚══███╔╝
█████╗ ██████╔╝███████║██╔██╗ ██║ ███╔╝
██╔══╝ ██╔══██╗██╔══██║██║╚██╗██║ ███╔╝
██║ ██║ ██║██║ ██║██║ ╚████║███████╗
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝
Franz offers a service pool for kafka producers, kafka consumers, data processes, additonally thread safe stacks and an object-tree for handling hierarchically data like JSON, XML, and so on.
Franz uses the jPAX project to store data in object-tree like structures.
Franz uses the shozo project to run on multithreaded processing.
See the adsbdb example for a microservice application using franz.
The example polls the REST APIs of adsbdb.com for aircraft, airlines, and flight routes. The received JSON is transformed to XML and pushed by several threaded producers to kafka.
Three consumers read the data sets from beginning and then continuously by event and transforms the XML to an object tree. Those objects are stored to a thread safe stack.
Additional processes are waiting for object in the stacks and pop those for a data aggregation. For example, reading the ICAO type of the aircrafts and hash mapping those in lists for a simple favorite statistic.
Franz needs an apache kafka running having the topics airline, aircraft, and callsign configured.
For setting up an apache kafka instance on a GNU Linux machine, a quick start guide is available.
After having the apache kafka running, e.g. by your localhost on port 9092, create these topics by:
bin/kafka-topics.sh --create --topic logs --bootstrap-server localhost:9092
bin/kafka-topics.sh --create --topic airline --bootstrap-server localhost:9092
bin/kafka-topics.sh --create --topic aircraft --bootstrap-server localhost:9092
bin/kafka-topics.sh --create --topic callsign --bootstrap-server localhost:9092There is a simple bash script available within the project to listen to topics, called: kafka-consumer.sh. Make your changes on your bootstrap server and on your port and you can listen to the topics from beginning on by:
./kafka-consumer.sh logs
./kafka-consumer.sh airline
./kafka-consumer.sh aircraft
./kafka-consumer.sh callsignor for having only the live entries
./kafka-consumer-live.sh logs
# ..
./kafka-consumer-live.sh callsignGradle Wrapper is generated in version 9; try:
./gradlew build jarIf you need to settle another version of the wrapper, get the latest gradle version and install it.
The change to your cloned directory of franz and
gradle wrapper
./gradlew build