ainterface / ainterface   0.1

Apache License 2.0 GitHub

Runs an Erlang node on an ActorSystem of Akka.

Scala versions: 2.11


Build Status

Ainterface provides APIs to communicate with Erlang processes, like Jinterface. And APIs of Ainterface are designed to integrate Akka with Erlang seamlessly.


Since Ainterface is an experimental project, there is no guarantee that APIs will not be changed.


  • Published(non hidden) mode support
  • Short node names support
  • Non distributed mode support
  • Provides binary pattern matching for ByteString



You should add the following dependency.

libraryDependencies += "com.okumin" %% "ainterface" % "0.1"


In application.conf,

akka {
  ainterface {
    # The name of root actor of ainterface-system.
    root-name = "ainterface-system"

    init {
      # -name
      # Makes the Erlang runtime system into a distributed node and configure the name.
      name = "node-name-your-application"

      # -setcookie
      # Sets the magic cookie of the node to Cookie.
      # If `setcookie` is not specified, `$HOME/.erlang.cookie` is used.
      #setcookie = ""


First, start an Erlang node and EPMD.

$ erl -name mofu
Erlang/OTP 17 [erts-6.2.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V6.2.1  (abort with ^G)
([email protected])1>

Set up Ainterface.

scala> val config = com.typesafe.config.ConfigFactory.parseString("""
     | akka {
     |   loglevel = "ERROR"
     |   ainterface {
     |     root-name = "ainterface-system"
     | = "ainterface-sample" // the node name
     |   }
     | }
     | """)
config: com.typesafe.config.Config = Config(SimpleConfigObject({"akka":{"ainterface":{"init":{"name":"ainterface-sample"},"root-name":"ainterface-system"},"loglevel":"ERROR"}}))

scala> val system ="sample", config)
system: = akka://sample

scala> akka.ainterface.AinterfaceSystem.init(system) // initialize

Start an echo server with the registered name echo.

scala> val echo = system.actorOf([ainterface.EchoActor])
echo: = Actor[akka://sample/user/$a#1942167954]

You can send messages from the Erlang node to Akka! The echo server returns his pid and hello message.

([email protected])1> {echo, '[email protected]'} ! {self(), hello}.
([email protected])2> flush().
Shell got {<6209.1.0>,hello}

The other examples are here.


Apache 2.0