Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cedrickchee/kafka-eventsourcing-restapi

REST API service using Apache Kafka for event sourcing
https://github.com/cedrickchee/kafka-eventsourcing-restapi

event-sourcing golang-examples kafka kafka-cluster rest-api

Last synced: about 1 month ago
JSON representation

REST API service using Apache Kafka for event sourcing

Awesome Lists containing this project

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.