Internal service locator issue


(Jayaram250) #1

Dear Team,

We are using lagom service for our microservice architecture but we are getting a issue with internal service locator like we are unable to call from one service(order) to another service(enquiry) in lagom

Error:
2018-03-13T13:43:21.976Z [error] order [] - Exception in RestCallIdImpl(POST,/api/order)
java.lang.IllegalStateException: Service enquiry was not found by service locator
at com.lightbend.lagom.internal.client.ClientServiceCallInvoker$$anonfun$doInvoke$2.apply(ClientServiceCallInvoker.scala:75)
at com.lightbend.lagom.internal.client.ClientServiceCallInvoker$$anonfun$doInvoke$2.apply(ClientServiceCallInvoker.scala:72)

How to fix it?


(Ignasi Marimon-Clos) #2

Hi @jayaram250,

it looks like the order service has a servicelocator that uses a DB/ZooKeeper/DNS where there is not enough information to resolve the location of the enquiry service.

Usually, when a process starts it’s responsible for announcing itself into the service registry where the service location happens. For example, using a ZookeeperServiceLocator, the enquiry service would have to contact the Zookeeper brokers and add it’s IP:port on the list of instances that can serve the enquiry service.

HTH,


(Jayaram250) #3

Hi Ignasi,

Its not a static Ip and port that will be create by lagom service with different IP and port
and the issue is we are using service client to pull impl data from one service to another service.


(Ignasi Marimon-Clos) #4

Hi @jayaram250,

a service usually does the following immediately after starting up:

  1. determine my IP
  2. read the $PORT value I was told to listen to by the orchestration sw that started me
  3. contact the service registry and announce that I’m ready to serve incoming requests

That’s what your enquiry service is doing (or should be doing) when it boots up.
Then, a client trying to use enquiry will:

  1. contact the service registry
  2. ask for an IP:PORT where the enquiry service is being served
  3. contact that IP:PORT and send the request.

IIUC, your system fails on either step 1 or step 2. of the client flow. There are several reasons: the client didn’t locate the service registry, the enquiry service did not register so the service registry is empty, etc…

All the above assumes neither the service or the client use static IPs (or ports actually).

If there’s a way you can share some code or details wrt the actual ServiceLocator implementation you are user it could be very helpful.

Cheers,


Service not found. Hint: Maybe it was not registered?
(Chandan Pasunoori) #5

Hi @ignasi35

We successfully integrated ‘service-locator-dns’ in Lagom and deployed in Kubernetes, All services in Lagom project are properly resolving with Kubernetes SRV requests.

means the above issue is resolved(for internal services)

But even statically defined(in build.sbt) or external non-lagom projects also go through name-translators and srv-translators and finally not resolving.

I have raised the issue for the same in Github https://github.com/lightbend/service-locator-dns/issues/29
and stackoverflow https://stackoverflow.com/questions/49378928/unable-to-use-non-lagom-based-static-project-services-with-service-locator-dns-l

Can we avoid this with changes in name-translators itself or do we need to do any extra changes?


(Chandan Pasunoori) #6

Hi @ignasi35

I submitted the pull request for my specific requirement without much checking on optimisation etc.
I would like to discuss on this, where this is correct approach or not etc.