The-Microservice-Dungeon / player-robocop

MIT License
0 stars 0 forks source link

Rework Eventing System #44

Open OliverWich opened 2 years ago

OliverWich commented 2 years ago

Currently we consume all events instantly, maybe delay them to try to get the order right. This is ugly and hacky.

Possible Solution:

  1. Reveive an event
  2. Check if it belongs to us
  3. Save it in a repo
  4. Build the dependency tree for this event (i.e. "neighbours" needs "trading" or "movement"; "bank_created" needs "player_status" after registration.)
  5. Somehow tell the System Services when all Dependencies for one Event were consumed
  6. Then start executing the actions caused by the events
JannikAlx commented 2 years ago

For 5: maybe some form of counter that decreases with each consumed event (only relevant ones ofc)?

JannikAlx commented 2 years ago

Maybe some type of semaphore? Not sure if this is applicable, but using each individual event as a condition this might work. Link.

JannikAlx commented 2 years ago

Actually: Kafka Streams

Edit: nvm, deosnt seem to solve our problem. This might be because the problem itself goes against kafka philosophy

OliverWich commented 2 years ago

Actually: Kafka Streams

Edit: nvm, deosnt seem to solve our problem. This might be because the problem itself goes against kafka philosophy

Yup, Kafka does not guarantee event order across multiple topics by design ¯\(ツ)