kafka-eventsourcing-restapi

module
v0.0.0-...-73f6e13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2020 License: MIT

README

REST API and Event Sourcing with Kafka

This is a skeleton project for a Go REST API service using Kafka for event sourcing.

Demo

This has only been tested on Linux, and depends on Docker to build.

Running Kafka

Start Kafka cluster with Docker Compose:

HOST_IP=your-ip docker-compose -f docker-compose-kafka.yml up

After that, create a Kafka topic "notification" using this command:

docker run --net=host --rm confluentinc/cp-kafka:5.0.0 kafka-topics --create --topic notification --partitions 4 --replication-factor 2 --if-not-exists --zookeeper localhost:32181

This will create the topic "notification" with 4 partitions and replication factors = 2.

Building

Build and run Go application inside Docker.

You can try this project without installing Go, just run:

HOST_IP=your-ip docker-compose up --build

It will build and run the API and 2 worker inside Docker container.

Directories

Path Synopsis
cmd
api
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳