Starting out with Event Sourcing

Hi!

I’m building an app that will eventually become a live charting tool for financial markets. I have a docker container that is a websocket client listening for updates to Order Book data.

The events coming through are shaped like:

{
  "eventId": "f2c782b7-c02d-4373-b033-16f2c85d185d",
  "eventType": "orderBookModify",
  "data": {
    "marketKey": "ETH_OMG",
    "mutationType": "modify",
    "mutationSide": "bid",
    "rate": "0.02101132",
    "amount": "28.02190441"
  }
}

``

There is also an event which get’s sent only once and before all other events for every market and it’s the OrderBookState event. It contains the complete current state of the orderbook; The Ask and Bid prices and volumes per price.

I have set up my Docker Container to insert these events into streams named OrderBook_${marketKey}. It’s chugging along happily now at 30-3000 events/second.

The first thing I would like to do with the data is show it on the screen, so I want an Order Book page where I can select the market and it would show me the order book state at that moment. I have read about Projections and it seems like a good fit to represent this state. I am using this api (since it seems to be the most used in Node.js) https://github.com/RemoteMetering/geteventstore-promise#projections but it doesn’t tell me a lot about how to get a Projection into EventStore.

I have some questions:

  • I have contually restarting processes (on any file write) in development mode inside my docker containers. If my docker container is responsible for “bringing the code to the data” and putting a projection into EventStore, would I have to make it so that it deletes any ‘old’ projections and starts new ones every time the container restarts or a Projection definition file gets updated? how do I guarantee that once I have a screen to display the state on that I’m looking on the page at the latest version I just saved on disk?
  • I use GraphQL instead of REST which is divided into a Read side and a Write side. Does this adhere to CQRS principles e.g. I’m already all set this way?
  • If I use EventStore with Projections, does that mean that I do not have to save the data into e.g. PostgreSQL and I can query it directly from my GraphQL Read side?
    p.s. I think it would be awesome if there was an IRC or gitter.im or Slack community for Live chat about EventStore.

Normally we just kept this data as an in memory projection (far simpler) and then would give redundancy by having N of them