You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/04/12 06:11:32 UTC

[GitHub] [servicecomb-samples] wujimin commented on a change in pull request #2: 项目升级到1.2.0,并且增加相关的说明

wujimin commented on a change in pull request #2: 项目升级到1.2.0,并且增加相关的说明
URL: https://github.com/apache/servicecomb-samples/pull/2#discussion_r274770564
 
 

 ##########
 File path: porter_lightweight/README.md
 ##########
 @@ -79,4 +79,113 @@ java $JAVA_OPT -Dgateway.webroot=webapp -jar porter-gateway-service-0.0.1-SNAPSH
 2. 选择一个文件上传,上传成功,上传成功后的文件会保存在file-service的当前目录, 文件名称是一个随机的数字,这个数字就是文件ID。
 3. 删除文件:输入上一步的文件ID,点击删除。 如果是admin用户,上传成功;如果是guest用户,上传失败。
 
+# 接口使用说明
+ServiceComb推荐先定义接口,再定义实现的开发模式。将接口定义为一个独立项目,可以由设计者统一管控,对于接口的修改,需要设计者进行审核。先定义接口还可以让开发者培养良好的开发习惯,避免将对外接口采用内部实现数据结构(比如JsonObject)、运行平台有关的数据结构(比如HttpServletResponse)来定义,使得以后将项目改在为其他技术框架变得复杂。采用这种方式组织的项目,用户很容易在不同的开发框架上进行迁移,比如gRPC、Spring Cloud等。这里的接口定义代码,对于这些运行框架都是通用的,并且具备跨平台特性。
 
+## 对于接口实现者(provider)
+  * 依赖api对应的jar包
+
+```
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>user-service-api-endpoint</artifactId>
+    </dependency>
+  </dependencies>
+```
+
+  * 实现Service接口
+```
+@Service
+public class UserServiceImpl implements UserService
+```
+
+## 对于接口使用者(consumer)
+  * 依赖service对应的jar包(只包含model和接口)
+
+```
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb.samples.porter</groupId>
+      <artifactId>user-service-api-service</artifactId>
+    </dependency>
+  </dependencies>
+```
+
+  * 采用RCP方式调用
 
 Review comment:
   RPC

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services