Skip to content

feferka/kafka-repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kafka-repository

Motivation:

To access a Kafka topic like a collection.

Internally uses GlobalKTable which is persisted as RockDB in local file system in state-dir directory.

Usage:

    @Repository
    public class LocationRepository extends KafkaRepository<String, Location> {
    
        public LocationRepository(StreamsBuilderFactoryBean streamsBuilderFactoryBean, KafkaConfig kafkaConfig) {
            super(streamsBuilderFactoryBean,
                    kafkaConfig.getLocationTopic(),
                    "locations-store",
                    Serdes.String(),
                    new JsonSerde<>(Location.class));
        }
    }

KafkaRepository will provide two basic methods:

    public V getByKey(K key);

    public Stream<KeyValue<K, V>> findAll();

Kafka user doesn't need to have rights to manage topics.
( It doesn't create Kafka streams internal topics or changelogs ... )

About

Kafka repository using Kafka Streams GlobalKTable

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages