Do you think that using akka actors in front of transactional service beans, is a good idea ?

Actors are waked up by a facade used by a client application, and actor use a message to handle right service call.

Is it a good practice ?

This article (http://honeysoft.wordpress.com/2012/08/05/akka-actor-dependency-injection-using-spring/) is talking about using spring beans with akka actors. But I could not see the gain to use actors in front of (singleton) spring beans.

1 Answer 1


Since the Akka docs state that Actors should not block (on IO, sockets, ...) unless it's is really unavoidable, it sounds like there might be little value in having actors wrap transactional services, of which I'm assuming the majority will be backed by transactional databases.

There might be other reasons to using Actors of course (the remoting, durable inboxes, clustering, ...)

  • I am not sure I understand the problem entirely. Do you mean that an actor would have to wait for a transaction to be complete and that this behaviour would contradict the normal semantics of an actor (asynchronous message passing, non-blocking)?
    – Giorgio
    Commented Feb 12, 2013 at 11:29
  • Yes, that's why i think that using actors in front of spring is not a good idea. Maybe that's why there is not (yet) akka-spring 2.1. I can see in most website, that used spring with akka, is in fact a little redundant.
    – Zenithar
    Commented Feb 12, 2013 at 13:22
  • @Girogio: yes, that's how I understood it. It's not using Actors in front of Spring services that is a bad idea as such, but using Actors that do blocking operations (of which most Transactional services that do database access are). You could definitely use Actors calling Spring based services that don't do blocking operations without problems. Commented Feb 13, 2013 at 9:14
  • You can use actors in front of blocking operations -- but you should only do so if those actors are on a different dispatcher. That way the threads on the main dispatcher are not blocked, and your blocking I/O doesn't prevent non-blocking operations from continuing. Commented Apr 20, 2017 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.