[英]Name call in lagom service call?
I am starting lagom and going through the doc and found this sample code :我正在启动 lagom 并浏览文档并找到此示例代码:
named("hello").withCalls(
namedCall("hello", sayHello)
)
And when implemented using REST, it says this call will have a path of /hello.当使用 REST 实现时,它说这个调用将有一个 /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 ?现在的问题是, /hello
指您好,首先“你好” named("hello")
或第二打招呼namedCall("hello")
并做到这一点都“你好”的名字应该是一样的吗?
The first hello
is a name for the service.第一个hello
是服务的名称。 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.当客户端查找服务时,它将使用该名称,将其传递给ServiceLocator
,根据其实现,它可能会将其转换为 DNS 查找或类似的内容。
The second hello
refers to the /hello
path.第二个hello
指的是/hello
路径。
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
.在这种情况下,路径将是/sayHello
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.