This example showcases an event-sourced CQRS system based on github.com/romshark/eventlog

Eventlog Example

This example is showcasing an eventually consistent, fault-tolerant, event sourced system following the CQRS (Command-Query-Responsibility-Segregation) principle consisting of two individual microservices using romshark/eventlog as both an event database and communication bus. The producer service produces events of objects being put into a virtual pile, while the consumer service consumes them and projects the current state of the pile onto its dgraph-io/badger key-value database. The producer service also projects the world onto its own database to transactionally check for invariants (preventing take events from being commited when there aren't enough objects in the pile). The system uses OCC (Optimistic Concurrency Control) to enforce invariants and keep the log in a consistent and valid state.

Getting started

  • Run the eventlog in in-memory mode: eventlog inmem -http-host :9090
  • Run the consumer: cd cmd/consumer && go run main.go -log-addr :9090
  • Run the producer: cd cmd/producer && go run main.go -log-addr :9090
  • Optionally, you can use -db-dir on both the consumer and producer to make them use an actual persistent database, otherwise they will use an in-memory database by default. -db-log will enable more detailed database debug logs.

The order in which the services are run isn't important, the system will automatically try to (re)connect to the log indefinitely.

Owner
Roman Sharkov
Backend Engineer
Roman Sharkov
Similar Resources

Proof-of-concept SLSA provenance generator for GitHub Actions

SLSA GitHub Actions Demo A proof-of-concept SLSA provenance generator for GitHub Actions. Background SLSA is a framework intended to codify and promot

Nov 4, 2022

a microservice framework for rapid development of micro services in Go with rich eco-system

a microservice framework for rapid development of micro services in Go with rich eco-system

中文版README Go-Chassis is a microservice framework for rapid development of microservices in Go. it focus on helping developer to deliver cloud native a

Dec 27, 2022

Easegress (formerly known as EaseGateway)is an all-rounder traffic orchestration system

Easegress (formerly known as EaseGateway)is an all-rounder traffic orchestration system

Easegress (formerly known as EaseGateway)is an all-rounder traffic orchestration system

Dec 28, 2022

Demo Fully Isolated System Architecture

Fully Isolated System Architecture (Microservices) Arsitektur Request | | | Api Gateway --- Auth Provider |\________________________

Dec 13, 2022

NewSQL distributed storage database based on micro service framework

NewSQL distributed storage database based on micro service framework

QLite 是基于微服务的 NewSQL 型数据库系统,与传统的一体化数据库不同,该系统将本该内置的多种数据结构(STL)拆分成多个服务模块,每个模块都是独立的一个节点,每个节点都与其主网关进行连接,从而形成分布式存储结构。

Jun 19, 2022

Design-based APIs and microservices in Go

Design-based APIs and microservices in Go

Goa is a framework for building micro-services and APIs in Go using a unique design-first approach. Overview Goa takes a different approach to buildin

Jan 5, 2023

Generates Golang client and server based on OpenAPI2 (swagger) definitions

Generates Golang client and server based on OpenAPI2 (swagger) definitions

ExperienceOne Golang APIKit ExperienceOne Golang APIKit Overview Requirements Installation Usage Generate standard project structure Define the API wi

Aug 9, 2022

Concourse is a container-based continuous thing-doer written in Go and Elm.

Concourse is a container-based continuous thing-doer written in Go and Elm.

Concourse: the continuous thing-doer. Concourse is an automation system written in Go. It is most commonly used for CI/CD, and is built to scale to an

Dec 30, 2022

🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go.

🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go.

🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go. Support Nacos ,Consoul ,Etcd ,Eureka ,kubernetes.

Jan 4, 2023
Application tracing system for Go, based on Google's Dapper.

appdash (view on Sourcegraph) Appdash is an application tracing system for Go, based on Google's Dapper and Twitter's Zipkin. Appdash allows you to tr

Nov 28, 2022
Trying to build an Ecommerce Microservice in Golang and Will try to make it Cloud Native - Learning Example extending the project of Nic Jackson

Golang Server Project Best Practices Dependency Injection :- In simple words, we want our functions and packages to receive the objects they depend on

Nov 28, 2022
This is an example to demonstrate implementation golang microservices using domain driven design principles and sugestions from go-kit

go-kit DDD Domain Driven Design is prevelent and rising standard for organizing your microservice code. This design architecture emphasis on Code orga

Feb 9, 2022
This is demo / sample / example project using microservices architecture for Online Food Delivery App.

Microservices This is demo / sample / example project using microservices architecture for Online Food Delivery App. Architecture Services menu-servic

Nov 21, 2022
Example golang microservices deployed on kubernetes.
Example golang microservices deployed on kubernetes.

Tech Stack Golang RabbitMQ Docker K8S MongoDB Services There are two services which communicate via http(sync) and rabbitmq(async). Services opened to

Sep 6, 2022
Entgo openapi example for go

entgo-openapi-example Example app created with ent entgen swagger-editor See https://entgo.io/blog/2021/09/10/openapi-generator/ License MIT Author Ya

Nov 27, 2021
Hexagonal architecture bank account example

Hexagonal architecture bank account example Esse repositório contém um pouco dos meus estudos sobre arquitetura hexagonal. Go Lang é a linguagem utili

Jan 8, 2022
String Service. Microservice example using gokit library

Example of Microservices using go-kit Go kit is a collection of Go (golang) packages (libraries) that help you build robust, reliable, maintainable mi

Dec 6, 2021
An example microservice demo using kubernetes concepts like deployment, services, persistent volume and claims, secrets and helm chart

Docker vs Kubernetes Docker Kubernetes container tech, isolated env for apps infra management, multiple containers automated builds and deploy apps -

Dec 13, 2021
Go-kit-microservices - Example microservices implemented with Go Kit

Go Kit Microservices Example microservices implemented with go kit, a programmin

Jan 18, 2022