How to register external (unmanaged) service in Lagom 1.5 prod mode

I’m referring to this guide https://developer.lightbend.com/guides/openshift-deployment/lagom/index.html to deploy online-auction-scala with lagom 1.5 to k8s. Since Lightbend Orchestration is not supported with Lagom 1.5, I’m wondering if there is an easy way at the moment to register elastic-search as an external service or I should create a factory and a client like described in https://www.lagomframework.com/documentation/1.5.x/scala/IntegratingNonLagom.html?

Hi,

With Lightbend Orchestration - Reactive lib external services are configured by mapping service names with DNS SRV records (details can be found here).
For elastic search it would be similar to this:

external-service “elastic-search=_http._tcp.elastic-search.lagom.svc.cluster.local

(assuming port name is http and service name is elastic-search)

Lagom Akka discovery service locator uses the same principals but only a different syntax.
You can check it here.
So for ES you should add in you application.conf:

lagom.akka.discovery.service-name-mappings.elastic-search.lookup=http._tcp.elastic-search.lagom.svc.cluster.local

Or put in your deployment JAVA_OPTS ENV:

-Dlagom.akka.discovery.service-name-mappings.elastic-search.lookup=http._tcp.elastic-search.lagom.svc.cluster.local

The same way you can also configure cassandra and kafka:

-Dlagom.akka.discovery.service-name-mappings.cas_native.lookup=_cql._tcp.cassandra.lagom.svc.cluster.local

-Dlagom.akka.discovery.service-name-mappings.kafka_native.lookup=_broker._tcp.kafka.mynamespace.svc.cluster.local

Hope this helps.

Br,
Alan

1 Like

Thanks Alan, that’s what I was looking for :slight_smile: