TinaTiel / obs-chatbot

GNU General Public License v3.0
3 stars 0 forks source link

Concurrency / Multithreading #17

Closed TinaTiel closed 3 years ago

TinaTiel commented 3 years ago

Feeling like I have a rough idea of how to configure a client. However, I feel like there's a gap in my understanding in how the client will be able to receive/broadcast messages currently.

So, let's take a break and dive into concurrency and multithreading -- then if necessary dive into scheduling/queueing in Spring / how to best architect this. Questions I have:

TinaTiel commented 3 years ago

Finally wrapped my head around this last night, it'll require me to change up my architecture a bit.

The main change and realizations I had were:

TinaTiel commented 3 years ago

Updated sketch of architecture for reference: photo5123074151182084261

TinaTiel commented 3 years ago

One more thing -- an example of a keyed FIFO executor is described here: https://stackoverflow.com/questions/2153663/controlling-task-execution-order-with-executorservice

In the actual implementation, I'd like to see if I can separate out those classes and the Map<Object, Queue> they reference together internally as nested static inner classes, and put them in their own class files. This should improve unit-testability, though I'm not 100% sure how I should handle this in Spring w.r.t. sharing a Map bean (that, or just put that inside the @Configuration class and wire it in as a dependency?)