I am designing an app to manage RabbitMQ workers given certain rules. For example:
- Maintain a minimum number of workers
- Spawn up to N max number of workers if queue grows beyond M tasks
- Kill workers older than X minutes
I originally thought of writing it in Go because it is compiled & I could simply compile the app to the target OS & daemonize it. However, my concept design involves having a loop that gathers data every Y seconds & passes it through a decision engine. The engine would then raise events that would be listened to by other goroutines to either spawn or kill workers.
I've found the Emission library which would acommodate this, but I read a comment somewhere that it might not be thread safe. Honestly, my knowledge of Go & threaded programming are not sufficient to properly evaluate if this library would accomplish what I need or if this is even possible in Go.
I could write this very quickly in NodeJS and even get it compiled using nexe. However, I wanted to learn a new language, I liked the targeted compilation in Go, and that it can be multi-threaded beyond the goroutines themselves.
Is this possible or am I trying to shoehorn something into Go that it wasn't designed to do? Would it be better to accomplish the same goals differently or to just use a different language all together?