Skip to content

amitayh/event-sourcing-kafka-streams

Repository files navigation

Event Sourcing with Kafka Streams

This is a POC for using Kafka Streams as a backbone for an event sourced system.

Running the project locally

You can either run the project with Docker Compose, or run everything on your host.

Prerequisites

  1. Install sbt (help)

  2. Build the project:

    $ sbt assembly
    

Run with Docker Compose

  1. Update your host IP address in .env

  2. Build images

    $ docker-compose build
    
  3. Start the containers

    $ docker-compose up
    

Run on host

Setup

  1. Run Zookeeper / Kafka (help)

  2. Run MySQL (help)

  3. Install the schema

  4. Create the topics (edit config/local.properties as needed):

    $ bin/setup.sh config/local.properties
    

Running

  1. Run the command handler:

    $ bin/commandhandler.sh config/local.properties
    
  2. Run the invoices list projector:

    $ bin/projector.sh config/local.properties
    
  3. Run the web server:

    $ bin/web.sh config/local.properties
    

If everything worked, you should be able to see the app running at http://localhost:8080/index.html

License

Copyright © 2018 Amitay Horwitz

Distributed under the MIT License