Akka in OSGi

Akka in OSGi

Configuring the OSGi Framework

To use Akka in an OSGi environment, the org.osgi.framework.bootdelegation property must be set to always delegate the sun.misc package to the boot classloader instead of resolving it through the normal OSGi class space.


To bootstrap Akka inside an OSGi environment, you can use the akka.osgi.AkkaSystemActivator class to conveniently set up the ActorSystem.

import akka.actor.{ Props, ActorSystem }
import org.osgi.framework.BundleContext
import akka.osgi.ActorSystemActivator

class Activator extends ActorSystemActivator {

  def configure(context: BundleContext, system: ActorSystem) {
    // optionally register the ActorSystem in the OSGi Service Registry
    registerService(context, system)

    val someActor = system.actorOf(Props[SomeActor], name = "someName")
    someActor ! SomeMessage



For the Apache Aries Blueprint implementation, there's also a namespace handler available. The namespace URI is https://akka.io/xmlns/blueprint/v1.0.0 and it can be used to set up an ActorSystem.

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

    <akka:actor-system name="BlueprintSystem" />

    <akka:actor-system name="BlueprintSystemWithConfig">
            some.config {