Git Product home page Git Product logo

event-source-example's Introduction

event-source-example

Trying out event sourcing

Requirements

  1. Google Pubsub
  2. Redis

How to Run

  1. Setup 2 google pubsub topics:
  • account-balance
  • gateway-account
  1. Setup 2 google pubsub subscriptions:
  • account-balance-sub
  • gateway-account-sub
  1. Create Google Credential JSON key, and place it on root folder with pubsub-cred.json filename.
  2. 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 into Stored Money) before send it back to logger.
  1. Run the app with go run logger/cmd/main.go go run balance/cmd/main.go go run gateway/cmd/main.go

Gateway App

Gateway app support 3 flag:

  1. account_id the ID of the requesting account
  2. event_type event that the account want to process. Currently support INPUTTED_MONEY and STORED_MONEY
  3. amount amount of the processed money. Must be positive integer.

event-source-example's People

Contributors

ridhoperdana avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.