Marathon API

Warning

This module is community maintained and the Lightbend subscription doesn’t cover support for this module. It is also marked as may change. That means that the API, configuration or semantics can change without warning or deprecation period.

Marathon currently ignores all fields apart from service name. This is expected to change.

If you’re a Mesos or DC/OS user, you can use the provided Marathon API implementation. You’ll need to add a label to your Marathon JSON (named ACTOR_SYSTEM_NAME by default) and set the value equal to the name of the configured effective name, which defaults to your applications actor system name.

You’ll also have to add a named port, by default akkamgmthttp, and ensure that Akka Management’s HTTP interface is bound to this port.

Project Info

Project Info: Akka Discovery Marathon
Artifact
com.lightbend.akka.discovery
akka-discovery-marathon-api
1.5.1
JDK versions
Eclipse Temurin JDK 11
Eclipse Temurin JDK 17
Scala versions2.13.12, 3.3.1
License
Readiness level
Since 0.10.0, 2018-01-26
Home pagehttps://akka.io/
API documentation
Forums
Release notesGitHub releases
IssuesGitHub issues
Sourceshttps://github.com/akka/akka-management

Dependencies and usage

The Akka dependencies are available from Akka’s library repository. To access them there, you need to configure the URL for this repository.

sbt
resolvers += "Akka library repository".at("https://repo.akka.io/maven")
Gradle
repositories {
    mavenCentral()
    maven {
        url "https://repo.akka.io/maven"
    }
}
Maven
<project>
  ...
  <repositories>
    <repository>
      <id>akka-repository</id>
      <name>Akka library repository</name>
      <url>https://repo.akka.io/maven</url>
    </repository>
  </repositories>
</project>

Additionally, add the dependency as below.

sbt
val AkkaManagementVersion = "1.5.1"
libraryDependencies += "com.lightbend.akka.discovery" %% "akka-discovery-marathon-api" % AkkaManagementVersion
Gradle
def versions = [
  AkkaManagementVersion: "1.5.1",
  ScalaBinary: "2.13"
]
dependencies {
  implementation "com.lightbend.akka.discovery:akka-discovery-marathon-api_${versions.ScalaBinary}:${versions.AkkaManagementVersion}"
}
Maven
<properties>
  <akka.management.version>1.5.1</akka.management.version>
  <scala.binary.version>2.13</scala.binary.version>
</properties>
<dependencies>
  <dependency>
    <groupId>com.lightbend.akka.discovery</groupId>
    <artifactId>akka-discovery-marathon-api_${scala.binary.version}</artifactId>
    <version>${akka.management.version}</version>
  </dependency>
</dependencies>

akka-discovery-marathon-api can be used with Akka 2.9.2 or later. You have to override the following Akka dependencies by defining them explicitly in your build and define the Akka version to the one that you are using. Latest patch version of Akka is recommended and a later version than 2.9.2 can be used.

sbt
val AkkaVersion = "2.9.2"
libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-cluster" % AkkaVersion,
  "com.typesafe.akka" %% "akka-discovery" % AkkaVersion
)
Gradle
def versions = [
  AkkaVersion: "2.9.2",
  ScalaBinary: "2.13"
]
dependencies {
  implementation "com.typesafe.akka:akka-cluster_${versions.ScalaBinary}:${versions.AkkaVersion}"
  implementation "com.typesafe.akka:akka-discovery_${versions.ScalaBinary}:${versions.AkkaVersion}"
}
Maven
<properties>
  <akka.version>2.9.2</akka.version>
  <scala.binary.version>2.13</scala.binary.version>
</properties>
<dependencies>
  <dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-cluster_${scala.binary.version}</artifactId>
    <version>${akka.version}</version>
  </dependency>
  <dependency>
    <groupId>com.typesafe.akka</groupId>
    <artifactId>akka-discovery_${scala.binary.version}</artifactId>
    <version>${akka.version}</version>
  </dependency>
</dependencies>

And in your application.conf:

akka.discovery {
  method = marathon-api
}

And in your marathon.json:

{
   ...
   "cmd": "path-to-your-app -Dakka.remote.netty.tcp.hostname=$HOST -Dakka.remote.netty.tcp.port=$PORT_AKKAREMOTE -Dakka.management.http.hostname=$HOST -Dakka.management.http.port=$PORT_AKKAMGMTHTTP",

   "labels": {
     "ACTOR_SYSTEM_NAME": "my-system"
   },

   "portDefinitions": [
     { "port": 0, "name": "akkaremote" },
     { "port": 0, "name": "akkamgmthttp" }
   ]
   ...
}
Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.