scala - How to correctly use Akka's Event Stream? -


i've been using akka's event stream in play app event bus can publish events , subscribe listeners , wanted know gotchas should take account. there 2 things:

  • each listener implemented via actor receives published events , processes them. if actor's message queue starts big? how can implement back-pressure safely, guaranteeing each event processed?
  • related previous one: how can persist unprocessed events so, in case of failure application can start again , process them? i'm aware of existence of akka-persistence i'm not sure if right thing in case: listener actors aren't stateful, don't need replay past events, want store unprocessed events , delete them once have been processed.

considering constraints not use akka's event bus purpose.

main reasons are:

  1. delivery - have no guarantees event listeners in fact listening (no ack). it's possible lose events on way.
  2. persistance - there no built in way of preserving event bus state.
  3. scaling - akka's event bus local facility, meaning it's not suitable if in future create cluster.

easiest way deal use message queue such rabbitmq. while using sstone/amqp-client. mq can provide persistent queues (queue each listener/listener type).


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -