Example application created for the presentation on GopherCon Russia 2019 (slides).
There are 3 versions of this application:
1.0
- just HTTP handler2.0
- using Watermill to handle payment initialization in the background3.0
- using Watermill CQRS component for initializing payments and counting bookings
Database adapters (in memory in this case) and domain layer is shared by all application versions.
Warning: this repository is using some Watermill unreleased features, which are still not released, like NewPoisonQueueWithFilter
or CorrelationIDWithAutogenerate
. They are now on cqrs-fix
branch and will be released in v0.4.0
.
For v2.0 and v3.0 you need Kafka. You can use docker-compose to run it:
docker-compose up
If you need some help with docker-compose setup, you should check our article about local Golang development environment.
And then you should run cmd/main.go
from application version which you want to run.
cd 3.0/cmd/
go run .
You can book a room using REST API using https://httpie.org/.
http POST localhost:6060/book-room RoomID=10 StartTime=2018-09-22T12:42:31Z EndTime=2018-09-22T12:42:31Z GuestsCount:=2 PaymentChannel="paypal" -v
- Update Watermill to the last release (some changes to CQRS need to be merged to the Watermill's
master
fromcqrs-fix
branch) - Some code cleanups and TODO's fixes
- Slides link
- Detailed description
Please join us on the #watermill
channel on the Gophers slack: You can get invite here.