multithreading - Possible / Recommended to write event driven app in Go? -


i designing app manage rabbitmq workers given rules. example:

  • maintain minimum number of workers
  • spawn n max number of workers if queue grows beyond m tasks
  • kill workers older x minutes

i thought of writing in go because compiled & compile app target os & daemonize it. however, concept design involves having loop gathers data every y seconds & passes through decision engine. engine raise events listened other goroutines either spawn or kill workers.

i've found emission library acommodate this, read comment somewhere might not thread safe. honestly, knowledge of go & threaded programming not sufficient evaluate if library accomplish need or if possible in go.

i write in nodejs , compiled using nexe. however, wanted learn new language, liked targeted compilation in go, , can multi-threaded beyond goroutines themselves.

is possible or trying shoehorn go wasn't designed do? better accomplish same goals differently or use different language together?

i had not seen emission library before work neatly send different messages workers. achieved using channels more flexible implementation more cumbersome if not know language.

i read on channels careful broadcasting through channels not straightforward. take @ example (https://rogpeppe.wordpress.com/2009/12/01/concurrent-idioms-1-broadcasting-values-in-go-with-linked-channels/)

overall take @ tunny (https://github.com/jeffail/tunny) manage workers has of implementation done you.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -