简体   繁体   English

我应该在什么级别集成两个服务(客户端与服务器)

[英]At what level should i integrate two services (client vs server)

I have a service Stock/Products(REST API) and a service Orders (RPC API). 我有一个服务库存/产品(REST API)和一个服务订单(RPC API)。 The Orders service will use some data from Stock/Products. 订单服务将使用库存/产品中的某些数据。

Orders will be used from a GUI Client. 订单将从GUI客户端使用。

I see two options for integrating: 我看到两个集成选项:

  1. use Stock/Products from the Orders service itself (integrate in the server) 使用订单服务本身的库存/产品(集成在服务器中)
  2. use Stock/Products from the GUI client.(integrate in the client/UI) 使用来自GUI客户端的库存/产品。(集成在客户端/ UI中)

Which would be a better approach? 哪种方法更好? I tend to choose (2) because i don't see why I would 'tunnel' the REST API through the RPC API. 我倾向于选择(2),因为我不明白为什么我会通过RPC API“隧道化” REST API。

I think you should prefer integration in the server, because encapsulation is better that way. 我认为您应该更喜欢服务器中的集成,因为这样封装更好。 Your chief objective should be to make life as easy for clients as possible. 您的主要目标应该是使客户的生活尽可能轻松。

The client should only need to know that they want their orders. 客户只需要知道他们想要他们的订单即可。 Let the server handle the details of assembling products. 让服务器处理组装产品的细节。

You have a perfect example in Amazon.com. 您在Amazon.com上拥有一个完美的例子。 They let you get what you need with a single request, but lots of services participate in making it so. 他们让您仅需一个请求就可以满足您的需求,但是很多服务都参与其中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我应该在一个或两个项目中实施JMS服务器和客户端吗? - Should i implement JMS server and client in one or two projects? 我应该如何使用客户端/服务器多玩家生存游戏? Java的 - What should I use for a Client/Server Multi-player survival game? Java 与证书的Java WS客户端-服务器通信,我应该使用哪些框架/ API? - java WS client-server communication with certificates, what frameworks/apis should i use? 我应该在客户端/服务器应用程序中使用套接字? - Should I use sockets in client/server application? 我应该如何运行服务器/客户端代码? - How should I run a Server/Client Code? 我应该为Amazon Web Services学习哪种类型的程序或样本? - What type of programs or samples I should learn for Amazon Web Services? 我应该使用什么来创建 Web 服务应用程序? - What should i use to create web services app? 客户端 - 服务器代码应该写在一个“项目”还是两个? - Should client-server code be written in one “project” or two? 客户端应调用哪个URL到同一域中的服务器 - what url should the client call to a server in the same domain 哪个SSH服务器应该发送给客户端以响应用户按下退格键? - What SSH server should send to the client as a response to user pressing backspace?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM