Marathon API

Warning

This module is 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 pekkomgmthttp, and ensure that Pekko Management’s HTTP interface is bound to this port.

Project Info

Project Info: Apache Pekko Discovery Marathon
Artifact
org.apache.pekko
pekko-discovery-marathon-api
1.0.0
JDK versions
OpenJDK 8
OpenJDK 11
Scala versions2.12.18, 2.13.12, 3.3.1
License
Home pagehttps://pekko.apache.org/
API documentation
Forums
Release notesRelease Notes
IssuesGitHub issues
Sourceshttps://github.com/apache/pekko-management

Dependencies and usage

This is a separate JAR file:

sbt
val PekkoManagementVersion = "1.0.0"
libraryDependencies += "org.apache.pekko" %% "pekko-discovery-marathon-api" % PekkoManagementVersion
Gradle
def versions = [
  PekkoManagementVersion: "1.0.0",
  ScalaBinary: "2.13"
]
dependencies {
  implementation "org.apache.pekko:pekko-discovery-marathon-api_${versions.ScalaBinary}:${versions.PekkoManagementVersion}"
}
Maven
<properties>
  <pekko.management.version>1.0.0</pekko.management.version>
  <scala.binary.version>2.13</scala.binary.version>
</properties>
<dependencies>
  <dependency>
    <groupId>org.apache.pekko</groupId>
    <artifactId>pekko-discovery-marathon-api_${scala.binary.version}</artifactId>
    <version>${pekko.management.version}</version>
  </dependency>
</dependencies>

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

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

And in your application.conf:

pekko.discovery {
  method = marathon-api
}

And in your marathon.json:

{
   ...
   "cmd": "path-to-your-app -Dpekko.remote.netty.tcp.hostname=$HOST -Dpekko.remote.netty.tcp.port=$PORT_PEKKOREMOTE -Dpekko.management.http.hostname=$HOST -Dpekko.management.http.port=$PORT_PEKKOMGMTHTTP",

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

   "portDefinitions": [
     { "port": 0, "name": "pekkoremote" },
     { "port": 0, "name": "pekkomgmthttp" }
   ]
   ...
}