GithubHelp home page GithubHelp logo

kafka-eventual-consistency's Introduction

Using Kafka for Multiple Persistence Sink & Eventual Consistency

Installing and starting Kafka (Instructions for OSX only :))

[Apache Kafka] (http://kafka.apache.org)

Exec the following command in your bash or zsh terminal

brew install kafka

This will also install all dependencies, like [Zookeeper] (https://zookeeper.apache.org) which is required to run the server.

Clone this project and then jump into it. The following commands are all from the project workdir.

zookeeper-server-start config/zookeeper.properties

This will start zookeeper.

kafka-server-start config/server.properties

This will start a single node Kafka cluster, watch those logs fly!

There's a spring boot app which contains both of the data sinks for the consumers to publish to which can be started by

mvn clean package spring-boot:run

There's a very simple web based viewer for the contents of the two store which can be access via

http://localhost:8080

You'll need to click the Search button each time to get the latest results.

To send a message to the topic named casemanager

echo '{"eventId" : "8", "name" : "Cyril"}' | kafka-console-producer --broker-list localhost:9092 --topic casemanager

This will put the json message into that topic ready for the consumers to pick off and populate the appropriate sinks.

Start the JPA consumer using:

mvn clean compile -Dproducer.properties=jpa-consumer.properties exec:exec@SimpleConsumerExample

Once this is started if you re-run the search in the UI you should see the entry Cyril for the RDBMS column.

Start the Elastic consumer using:

mvn clean compile -Dproducer.properties=elastic-consumer.properties exec:exec@SimpleConsumerExample

Again a re-run of the search will reveal that the Elastic sink has been populated with the same data.

kafka-eventual-consistency's People

Contributors

mattjtodd avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.