Not locatable tools service

I see tag deprecated for ServiceGuiceSupport#bindServices(…)

@deprecated support for multiple locatable ServiceDescriptors per Lagom service will be removed.

But I want create not locatable tools service (similar com.lightbend.lagom.javadsl.server.status.MetricsService ) and I don’t want to use deprecated method.
How to do it properly?

Hi @ihostage,

that is currently not possible.

Lagom 1.5 will introduce some improvements allowing the creation of lagom service composing a Lagom Service.Descriptor with some Akka-HTTP and/or play Routes .

Meanwhile, your alternative is to duplicate code on every Service.Descriptor. Can I ask what kind of non-locatable services are you trying to add?

Cheers,

Hi, Ignasi!
I want Lagom service can to provide its OpenAPI specification.
I tried to use Play file Assets for specification file, but Lagom 1.4.X not supported Service.Descriptor together with Play Routes.
And I wrote interface with helper function, that add path /<service_name>/openapi.json to Descriptor.

public interface OpenAPIService extends Service {

    ServiceCall<NotUsed, String> openapi();

    default Descriptor withOpenAPI(Descriptor descriptor) {
        return descriptor.withCalls(
                pathCall(format("/%s/openapi.json", descriptor.name()), this::openapi)
        );
    }

}

I use this helper for create locatable Descriptor

public interface MyService extends OpenAPIService {
    @Override
    default Descriptor descriptor() {
        return withOpenAPI(
            named("myservice")...
        );
    }
}

```java
public class MyServiceImpl extends AbstractOpenAPIService implements MyService {
...
}

But then I remembered MetricsService and I thought, how can I do the same not locatable service for OpenAPI.

PS: It’s great if Lagom 1.5 will can to have Play Routes with Service.Descriptor together :+1: