Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

scala - 在Lagom服务呼叫中呼叫名称?(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") 做到这一点都“你好”的名字应该是一样的吗?)

  ask by phineas translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 ,根据服务的实现,该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 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...