Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/cedrickchee/kafka-eventsourcing-restapi
- Owner: cedrickchee
- License: mit
- Created: 2020-05-04T17:38:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-04T18:16:24.000Z (over 4 years ago)
- Last Synced: 2024-09-29T21:22:10.745Z (about 2 months ago)
- Topics: event-sourcing, golang-examples, kafka, kafka-cluster, rest-api
- Language: Go
- Size: 301 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.
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.