# SPDX-License-Identifier: Apache-2.0

######################################################
# Pekko Discovery Config                              #
######################################################

pekko.actor.deployment {
  "/SD-DNS/async-dns" {
    mailbox = "unbounded"
    router = "round-robin-pool"
    nr-of-instances = 1
  }
}

pekko.discovery {

  # Users MUST configure this value to set the default discovery method.
  #
  # The value can be an implementation config path name, such as "pekko-dns",
  # which would attempt to resolve as `pekko.discovery.pekko-dns` which is expected
  # to contain a `class` setting. As fallback, the root `pekko-dns` setting scope
  # would be used. If none of those contained a `class` setting, then the value is
  # assumed to be a class name, and an attempt is made to instantiate it.
  method = "<method>"

  # Config based service discovery
  config {
    class = org.apache.pekko.discovery.config.ConfigServiceDiscovery

    # Location of the services in configuration
    services-path = "pekko.discovery.config.services"

    # A map of services to resolve from configuration.
    # See docs for more examples.
    # A list of endpoints with host/port where port is optional e.g.
    # services {
    #  service1 {
    #    endpoints = [
    #      {
    #        host = "cat.com"
    #        port = 1233
    #      },
    #      {
    #        host = "dog.com"
    #      }
    #    ]
    #  },
    #  service2 {
    #    endpoints = [
    #    {
    #        host = "fish.com"
    #        port = 1233
    #      }
    #    ]
    #  }
    # }
    services = {

    }
  }

  # Aggregate multiple service discovery mechanisms
  aggregate {
    class = org.apache.pekko.discovery.aggregate.AggregateServiceDiscovery

    # List of service discovery methods to try in order. E.g config then fall back to DNS
    # ["config", "pekko-dns"]
    discovery-methods = []

  }

  # DNS based service discovery
  pekko-dns {
    class = org.apache.pekko.discovery.dns.DnsServiceDiscovery
  }
}

