Consul

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.

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

If you are using Consul to do the service discovery this would allow you to base your Cluster on Consul services.

Project Info

Project Info: Akka Discovery Consul
Artifact
com.lightbend.akka.discovery
akka-discovery-consul
1.0.1
JDK versions
Adopt OpenJDK 8 with Hotspot
Adopt OpenJDK 11 with Hotspot
Scala versions2.11.12, 2.12.8, 2.13.0-M5
License
Readiness level
Since 0.15.0, 2018-07-02
Home pagehttps://akka.io/
API documentation
Forums
Release notesGitHub releases
IssuesGitHub issues
Sourceshttps://github.com/akka/akka-management
sbt
libraryDependencies += "com.lightbend.akka.discovery" %% "akka-discovery-consul" % "1.0.1"
Gradle
dependencies {
  compile group: 'com.lightbend.akka.discovery', name: 'akka-discovery-consul_2.12', version: '1.0.1'
}
Maven
<dependency>
  <groupId>com.lightbend.akka.discovery</groupId>
  <artifactId>akka-discovery-consul_2.12</artifactId>
  <version>1.0.1</version>
</dependency>

In your application conf add:

akka.discovery {
  method = akka-consul
  akka-consul {

    #How to connect to Consul to fetch services data
    consul-host = "127.0.0.1"
    consul-port = 8500

    # Prefix for consul tag with the name of the actor system / application name,
    # services with this tag present will be found by the discovery mechanism
    # i.e. `system:test` will be found in cluster if the cluster system is named `test`
    application-name-tag-prefix = "system:"

    # Prefix for tag containing port number where akka management is set up so that
    # the seed nodes can be found, an example value for the tag would be `akka-management-port:19999`
    application-akka-management-port-tag-prefix = "akka-management-port:"
  }
}

Notes:

  • Since tags in Consul services are simple strings, prefixes are necessary to ensure that proper values are read.

  • If Akka management port tag is not found on service in Consul the implementation defaults to catalog service port.

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.