title: How can OSGi and Akka benefit from each other? How is this structured?
body: <p>Following up my rather <a href="https://stackoverflow.com/questions/20122538/component-based-application-with-scalability-in-mind-osgi-or-akka">illogical question</a>, asking to use OSGi <strong>or</strong> Akka, I was advised that the two can be used together, and that they each solve a different problem. I could use OSGi to provide modularity and updatability, and Akka to provide scalability and performance. As there hasn't been a lot of experimenting with combining OSGi and Akka, I still have a couple of questions.</p>
  
  <p>How can OSGi and Akka be used together and benefit from each other? How is this structured? Do all your actors reside in one OSGi bundle, do they each get a separate bundle, is there a hybrid solution or isn't there really a 'right' way to do it?</p>
  
  <p>I would divide the big components in different OSGi bundles. Each bundle exists of different Akka actors. Each bundle can then be scaled separately from each other in function of the load on that bundle. In each bundle transparent load balancing can be used to spread the load over different actors.
  Would this be a correct and realistic way of doing this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thoughts after implementation:
  They clearly complement each other! I divided my application into big blocks, which I then injected into parts of the application using Spring. Inside the big blocks I solely used Akka. The gates to the blocks are Typed Actors. To make my system completely asynchronous I had to implement some extra functionality. So no blocking calls remain all interface methods should return the void type. Couldn't find any other way. You can then pass a message through the interface as an attribute that gets carried around for the whole journey of the request, which gets registered into a "Responder" at the beginning of the request. At the end a DeferredResult object gets successfully returned or an error/timeout is returned.</p>