Imagine that you are working for a large news publisher called Fairflax Media, inspired by flax flower (not to be mistaken with Fairfax Media, of course).
You have been tasked with breaking the huge monolith system into microservices and moving everything to Kuberentes. You prefer domain driven design, and believe that each database should only ever be owned by a single application. But as time goes by, you notice that many services need common data. You need to make sure that the data is consistent across all services and the query performance is reasonable.
master
branch contains the initial state - tightly coupled services.event-sourcing
branch should contain the Event Sourcing + CQRS implementation, containing asynchronous services, which are independent and easy to test.This project is intended for anyone willing to switch to a asynchronous microservice architecture using Golang.
Go 1.9 or later
$GOPATH
is set
dep
for managing dependencies
On Mac OSX using brew
...
$ brew install dep
$ brew upgrade dep
On other platforms you can use the install.sh script:
$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
Add ensure the PATH contains $GOPATH/bin
$ go help gopath
$ export PATH=$PATH:$GOPATH/bin
$ go get -u github.com/pavelnikolov/eventsourcing-go/demo-articles
$ go get -u github.com/pavelnikolov/eventsourcing-go/demo-graph
$ go get -u github.com/pavelnikolov/eventsourcing-go/demo-sitemap
$ go get -u github.com/pavelnikolov/eventsourcing-go/demo-rss
Either:
$ go get -u github.com/pavelnikolov/eventsourcing-go/...
Or:
$ mkdir -p $GOPATH/github.com/pavelnikolov
$ cd $GOPATH/github.com/pavelnikolov
$ git clone github.com/pavelnikolov/eventsourcing-go
Then install the dependencies:
$ dep ensure
Run in four different terminal windows:
go install ./cmd/demo-articles && demo-articles
go install ./cmd/demo-graph && demo-graph
go install ./cmd/demo-rss && demo-rss
go install ./cmd/demo-sitemap && demo-sitemap
Navigate to the apps in your browser:
Install protobuf compiler
Install the protoc Go plugin
$ go get -u github.com/golang/protobuf/protoc-gen-go
Rebuild the generated Go code
$ go generate github.com/pavelnikolov/eventsourcing-go/...
Or run protoc
command (with the grpc plugin)
$ protoc -I publishing/ publishing/publishing.proto --go_out=plugins=grpc:publishing