Closed egli closed 1 year ago
I've commented on the other ticket regarding error handling, I do think your handlers should handle their own errors, unless they deliberately don't because there is some mechanism higher up that handles it.
It sounds like your needs are fairly basic, you need a way to have an in-process event queue, and some kind of workers to split the work across threads, all inside the same process. In this case I think the stuff that Java gives you is pretty good. The java.concurrent
package has a bunch of queue implementation. I think for instance the LinkedBlockingQueue is a good default.
Then you can instantiate a ThreadPoolExecutor, and simply send functions to it to execute.
something like this:
(def executor (ThreadPoolExecutor. (+ 1 (.availableProcessors (Runtime/getRuntime)))
(+ 1 (.availableProcessors (Runtime/getRuntime)))
(long 10000)
TimeUnit/MINUTES
(LinkedBlockingQueue.)))
(.execute executor (fn [] ,,,))
The 0.9 release is moving away from immutant and uses plain old core.async. So this issue is no longer relevant
Message queues are used to build some sort of a state machine that move a production from one state to the next.
I guess the queues are implementing some sort of worker queues especially in the case of encoding and archiving which are both costly operations.
The implementation works fairly well but there are some down sides to it:
So the questions are: