增加databus-client使用说明
This commit is contained in:
31
docs/databus-client使用说明.md
Normal file
31
docs/databus-client使用说明.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Databus Client 使用说明
|
||||
|
||||
databus client 最主要用于调用基于http协议的第三方接口时需要记录调用日志到 databus 的情况, 通过databus client 调用第三方接口会将调用日志记录到databus的访问日志中
|
||||
|
||||
# 使用方法
|
||||
1. 添加依赖:
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-module-databus-client</artifactId>
|
||||
<version>3.0.47-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
2. 注入 DatabusClient
|
||||
```java
|
||||
@Resource
|
||||
private DatabusClient databusClient;
|
||||
```
|
||||
3. 方法说明
|
||||
* get(...) : 发送 get 请求
|
||||
* post(...): 发送 post 请求
|
||||
* put(...): 发送 put 请求
|
||||
* delete(...): 发送 delete 请求
|
||||
* doRequest(...): 发送自定义请求
|
||||
4. 方法参数说明(由于所有方法参数都是一样的,所以在此统一说明)
|
||||
* String urlString: 请求的 http 接口地址(get/delete请求不需要带url参数)
|
||||
* Map<String, Object> data: 请求的参数(post/put方法会转换为json提交, get/delete会拼接到url上)
|
||||
* Map<String, String> headers: 请求头信息
|
||||
* String appId: databus 的appid
|
||||
* String authToken: databus 的访问令牌
|
||||
* Method method: doRequest 方法独有,如果要使用 get/post/put/delete 之外的方法,请使用doRequest方法并通过method参数指定
|
||||
Reference in New Issue
Block a user