This project is a Java library for communicating with Marathon API. At this point this library supports version v2 of Marathon API, please refer to the docs for more details.
Add marathon-client as a dependency:
For Marathon v1.x:
<dependency> <groupId>com.mesosphere</groupId> <artifactId>marathon-client</artifactId> <version>0.6.0</version> </dependency>
For Marathon v0.x:
<dependency> <groupId>com.mesosphere</groupId> <artifactId>marathon-client</artifactId> <version>0.2.1</version> </dependency>
The following piece of code initializes the client.
MarathonClient.getInstance() method expects the endpoint for marathon:
String endpoint = "<Marathon's endpoint>"; Marathon marathon = MarathonClient.getInstance(endpoint);
The following will return all the applications that have been created:
GetAppsResponse appsResponse = marathon.getApps();
The following example demonstrates how a new application can be created:
App app = new App(); app.setId("echohisleepbye-app"); app.setCmd("echo hi; sleep 10; echo bye;"); app.setCpus(1.0); app.setMem(16.0); app.setInstances(1); marathon.createApp(app);
The following example, demostrates how to get details about an already created application:
GetAppResponse appGet = marathon.getApp("echohisleepbye-app");
The following example demostrate, how one can delete an existing application:
This project is built using Apache Maven.
Run the following command from the root of repository, to build the client JAR:
$ mvn clean install
Feign is used as the underlying REST library. Sometimes it is useful to see the low level JSON and responses. It is possible to setup debug without directed to stdout or to a log file.
This is simplified by set the environment variable
DEBUG_JSON_OUTPUT to either a file name
debug.log or to
Bugs can be reported using Github issues.