Trying out event sourcing
- Google Pubsub
- Redis
- Setup 2 google pubsub topics:
- account-balance
- gateway-account
- Setup 2 google pubsub subscriptions:
- account-balance-sub
- gateway-account-sub
- Create Google Credential JSON key, and place it on root folder with
pubsub-cred.json
filename. - The app is consist of 3 binary:
- gateway. This binary is to get data from client side, and send it to logger.
- logger. This binary is to process any occured event (from gateway and balance)
- balance. This binary is to process
Inputted Money
event and then process the data (change it intoStored Money
) before send it back to logger.
- Run the app with
go run logger/cmd/main.go
go run balance/cmd/main.go
go run gateway/cmd/main.go
Gateway app support 3 flag:
account_id
the ID of the requesting accountevent_type
event that the account want to process. Currently supportINPUTTED_MONEY
andSTORED_MONEY
amount
amount of the processed money. Must be positive integer.