简体   繁体   中英

Name call in lagom service call?

I am starting lagom and going through the doc and found this sample code :

named("hello").withCalls(
  namedCall("hello", sayHello)
)

And when implemented using REST, it says this call will have a path of /hello.

Now the question is , /hello refers to which hello, first "hello" in named("hello") or second hello in namedCall("hello") and does this both "hello" name should have to be same ?

The first hello is a name for the service. When a client looks up the service, it will use that name, passing it to the ServiceLocator , which, depending on its implementation, may translate it to a DNS lookup, or something similar.

The second hello refers to the /hello path.

They certainly do not have to be the same. This would also work:

named("hello").withCalls(
  namedCall("sayHello", sayHello)
)

In that case, the path would be /sayHello .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM