systemaccounting / mxfactorial

a payment application intended for deployment by the united states treasury that replaces banking with accounting
https://www.systemaccounting.org
46 stars 26 forks source link

add graphql subscription as sink to measure service websocket #377

Closed mxfactorial closed 2 weeks ago

mxfactorial commented 2 weeks ago

expected

graphql publishes the websocket produced by the new measure service as a subscription

initial end to end feature:

  1. postgres sends equilibrium insert notification, e.g. pg_notify("2024-08-07:gdp:usa:cal", "10");
  2. event service listens for and receives equilibrium insert notification, then incrbys a redis gdp key, e.g. INCRBY 2024-08-27:gdp:usa:cal 10 which increments, for example, the california gdp value to 40
  3. redis publishes the gdp value changed by incrby on a channel named after the gdp key, e.g. PUBLISH 2024-08-27:gdp:usa:cal 40
  4. measure service subscribes to redis, then receives the changed gdp value and passes it to a websocket
  5. graphql subscribes to gdp values sent on the measure service websocket and sends it to the public through a subscription

alternatives: current design avoids weighing down graphql with a redis dependency and keeps its concern of serving as a lightweight, public api separate, but events can avoid a double hop with a direct subscription by graphql to redis

hourly estimate

rust: 8 tests: 2 (shortened for poc)

total: 10

mxfactorial commented 2 weeks ago

hours worked

requirement writing: 1

mxfactorial commented 2 weeks ago

hours worked

13.25

2024-08-28 18 01 25