This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong-website.git


The following commit(s) were added to refs/heads/master by this push:
     new d3ca7e65b2 [INLONG-623][Doc] Update HTTP report guidance for Java/C++ 
(#624)
d3ca7e65b2 is described below

commit d3ca7e65b249e11d4b2c42af48cef16603e4433f
Author: Charles Zhang <[email protected]>
AuthorDate: Mon Nov 28 19:27:03 2022 +0800

    [INLONG-623][Doc] Update HTTP report guidance for Java/C++ (#624)
---
 docs/sdk/dataproxy-sdk/cpp.md                      |  95 ++++++++++
 docs/sdk/dataproxy-sdk/example.md                  | 195 ---------------------
 docs/sdk/dataproxy-sdk/http.md                     | 114 ++++++++++++
 docs/sdk/dataproxy-sdk/java.md                     | 107 +++++++++++
 docs/sdk/dataproxy-sdk/overview.md                 |  57 ------
 .../current/sdk/dataproxy-sdk/cpp.md               |  95 ++++++++++
 .../current/sdk/dataproxy-sdk/example.md           | 192 --------------------
 .../current/sdk/dataproxy-sdk/http.md              | 114 ++++++++++++
 .../current/sdk/dataproxy-sdk/java.md              | 107 +++++++++++
 .../current/sdk/dataproxy-sdk/overview.md          |  60 -------
 10 files changed, 632 insertions(+), 504 deletions(-)

diff --git a/docs/sdk/dataproxy-sdk/cpp.md b/docs/sdk/dataproxy-sdk/cpp.md
new file mode 100644
index 0000000000..c3eca131c3
--- /dev/null
+++ b/docs/sdk/dataproxy-sdk/cpp.md
@@ -0,0 +1,95 @@
+---
+title: C++ SDK
+sidebar_position: 1
+---
+
+import {siteVariables} from '../../version';
+
+## 新建实时同步任务
+在 Dashboard 或者通过命令行工具创建任务,数据源类型使用 `Auto Push` (自主推送)。
+
+## 引入 C++ SDK
+需要在项目中包含SDK的头文件和库,进行 SDK 的使用。头文件和库提供可以从源码自行编译,见 [SDK 
编译使用](https://github.com/apache/inlong/tree/master/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp)。
+
+## 数据上报流程
+引入 SDK 后,可以通过调用 SDK 的`send`相关接口进行单条(批量)数据的上报,发送 demo 可参考 
[send_demo.cc](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/release/demo/send_demo.cc)。整体流程包括以下三个步骤:
+
+### 初始化 SDK
+SDK 支持对象实例化和配置文件初始化两种方式(二选一即可):
+- 对象实例初始化
+首先初始化客户端配置,然后调用初始化接口:
+``` 
+// 初始化客户端配置
+ClientConfig client;
+// 设置client相关配置参数,其中proxy_URL_为必选参数(格式如下),其他参数详见client_config.h文件
+client.proxy_cluster_URL_="http://{Manager 
url}/inlong/manager/openapi/dataproxy/getIpList";
+// 初始化SDK, 返回值为零表示初始化成功,非零表示失败
+int32_t result = tc_api_init(client);
+```
+
+- 配置文件初始化
+配置文件采用 json 格式,见[配置文件说明](#附录:配置文件说明),通过配置文件初始化 SDK:
+```
+// 初始化SDK,参数为配置文件的路径名;返回值为零表示初始化成功
+int32_t result = tc_api_init("/home/conf/config.json");
+```
+
+### 调用发送接口进行数据上报
+SDK 
支持单条(推荐)和批量发送,二者发送过程均为异步模式,数据上报接口是线程安全的。在进行数据上报前,可设置回调函数在数据发送失败时进行回调处理,回调函数签名如下:
+```
+int32_t callBackFunc(const char* inlong_group_id, const char* 
inlong_stream_id, const char* msg, int32_t msg_len, const int64_t report_time, 
const char* client_ip);
+```
+
+- 单条数据数据上报接口
+```
+// 返回值:零表示发送成功,非零表示失败,具体异常返回值详见tc_api.h中的SDKInvalidReuslt
+int32_t tc_api_send(const char* inlong_group_id, const char* inlong_stream_id, 
const char* msg, int32_t msg_len, UserCallBack call_back = NULL);
+```
+
+- 批量数据上报接口
+```
+int32_t tc_api_send_batch(const char* inlong_group_id, const char* 
inlong_stream_id, const char** msg_list, int32_t msg_cnt, UserCallBack 
call_back = NULL);
+```
+
+### 关闭 SDK
+调用 close 接口关闭 SDK:
+```
+// 返回值为零表示关闭成功,后续无法再进行数据上报
+// max_waitms:关闭SDK前的等待最大毫秒数,等待SDK内部数据发送完成
+int32_t tc_api_close(int32_t max_waitms);
+```
+
+## 注意事项
+- SDK 的初始化和关闭都是进程级别的,只需初始化一次,fork 的子进程中需调用初始化接口后再进行数据上报;
+- 建议采用将 SDK 作为常驻服务来进行数据上报,避免同个进程中途频繁地初始化和关闭,重复初始化和关闭会带来更多开销;
+- SDK 发送是异步进行的,返回值为 0 表示数据成功存入了 SDK 
内部缓冲区,等待网络发送。如果`inlong_group_id`本身配置有误或者网络异常,也会导致数据发送失败,所以建议用户在调用该接口时设置回调,数据多次重试发送仍失败时执行回调。
+
+## 附录:配置文件说明
+配置文件格式和重要参数如下:
+```json
+{
+"init-param": {
+"thread_num": 5, // 网络收发线程的数量
+"enable_pack": true, // 是否多条打包发送
+"pack_size": 409600, // 数据达到pack_size大小,进行打包发送,单位字节
+"ext_pack_size": 409600, // 单条数据最大长度,单位字节
+"enable_zip": true, // 是否进行数据压缩
+"min_ziplen": 4096, // 最小压缩长度,单位字节
+"enable_retry": true, // 发送失败是否进行重试
+"retry_ms": 10000, // 重试间隔时间,单位毫秒
+"retry_num": 3, // 发送失败最大重试次数
+"max_active_proxy": 4, // tcp最大连接数,用于网络数据收发
+"max_buf_pool": 548576000, // 单个数据缓存区大小,单位字节
+"buffer_num_per_groupId": 3, // 每个groupid的数据缓存区个数
+"log_num": 10, // 最大日志文件数
+"log_size": 10, // 单个日志大小限制,单位MB
+"log_level": 3, // 日志级别,trace(4)>debug(3)>info(2)>warn(1)>error(0)
+"log_file_type": 2, // 日志输出,2->文件, 1->控制台
+"log_path": "./", // 日志路径
+"proxy_cfg_preurl": 
"http://127.0.0.1:8099/inlong/manager/openapi/dataproxy/getIpList";, // 
访问manager的url
+"need_auth": false, // 是否需要认证
+"auth_id": "admin", // 认证id
+"auth_key": "adminKey" // 认证key
+}
+}
+```
\ No newline at end of file
diff --git a/docs/sdk/dataproxy-sdk/example.md 
b/docs/sdk/dataproxy-sdk/example.md
deleted file mode 100644
index 534dcf9711..0000000000
--- a/docs/sdk/dataproxy-sdk/example.md
+++ /dev/null
@@ -1,195 +0,0 @@
----
-title: Example
-sidebar_position: 2
----
-
-import {siteVariables} from '../../version';
-
-## Overview
-Inlong-dataproxy-sdk provides access api for TCP and HTTP protocols. When 
using TCP or HTTP access, you need to ensure that the dataproxy server has the 
access configuration of the corresponding protocol (ie the TCP or HTTP source 
service). If the user needs to use the UDP protocol to access, the user needs 
to packets data according to the bytes arrays transmitted by TCP, and send them 
to the dataproxy server using the UDP protocol.
-and dataproxy server will handle messages in the same way as TCP.
-In addition, access demo codes for TCP, HTTP, and UDP protocols are provided 
in the example directory of inlong dataproxy SDK, which you can refer to when 
accessing.
-
-To view detailed API information [overview](./overview).
-
-## Add Dependency
-<pre><code parentName="pre">
-{`<dependency>
-    <groupId>org.apache.inlong</groupId>
-    <artifactId>dataproxy-sdk</artifactId>
-    <version>${siteVariables.inLongVersion}</version>
-</dependency>
-`}
-</code></pre>
-
-## TCP Example
-
-### Create a messageSender
-```java
-    public DefaultMessageSender getMessageSender(String localIP, String 
inLongManagerAddr, String inLongManagerPort,
-            String netTag, String dataProxyGroup, boolean isLocalVisit, 
boolean isReadProxyIPFromLocal,
-            String configBasePath, int msgType) {
-        ProxyClientConfig dataProxyConfig = null;
-        DefaultMessageSender messageSender = null;
-        try {
-            dataProxyConfig = new ProxyClientConfig(localIP, isLocalVisit, 
inLongManagerAddr,
-                    Integer.valueOf(inLongManagerPort), dataProxyGroup, 
netTag);
-            if (StringUtils.isNotEmpty(configBasePath)) {
-                dataProxyConfig.setConfStoreBasePath(configBasePath);
-            }
-            dataProxyConfig.setReadProxyIPFromLocal(isReadProxyIPFromLocal);
-            messageSender = 
DefaultMessageSender.generateSenderByClusterId(dataProxyConfig);
-            messageSender.setMsgtype(msgType);
-        } catch (Exception e) {
-            logger.error("getMessageSender has exception e = {}", e);
-        }
-        return messageSender;
-    }
-```
-
-The parameter description is as follows:
-
-| parameter name         | type     | instruction                              
  |
-|-----------------------|----------|--------------------------------------------|
-| inLongManagerAddr      | String   | inlong admin server address              
             |
-| inLongManagerPort      | String   | inlong admin server port                 
           |
-| netTag                 | String   | Network label, not used yet, you can 
pass an empty string                |
-| dataProxyGroup         | String   | dataProxy group name, the name used for 
local configuration when the user enables local configuration         |
-| isLocalVisit           | boolean  | Whether to use local configuration, true 
use https to access the console, false use http to request the console|
-| isReadProxyIPFromLocal | boolean  | Whether to obtain the address 
information of the Dataproxy server from the local configuration file, local 
self-test, can be set to true if the management console cannot be accessede|
-| configBasePath         | String   | The path of the local configuration 
file. The default is ./inlong. When isReadProxyIPFromLocal is true, the 
configuration file is searched from this directory|                             
    |
-| msgtype                | int      | Message assembly type, value (3, 5, 7, 
8), it is recommended to use 7, each message type represents a message assembly 
protocol during the transmission process, please refer to the code 
implementation of SDK for details|
-
-When isReadProxyIPFromLocal is true, the configuration information of 
Dataproxy will be obtained from the local configuration file.
-
-The path to the local file is :
-```
-    ${configBasePath}
-```
-The file name is :
-```
-    ${dataProxyGroup}.local
-```
-For example:
-```
-    configBasePath = /data/inlong
-    dataProxyGroup = inlong_test
-```
-Then the full path of the local file is:
-```
-    /data/inlong/inlong_test.local
-```
-
-The file configuration content is (json format), where host is the address of 
the DataProxy server, and port is the corresponding port, which requires at 
least two configurations (the same two items can be configured):
-```json
-    
{"isInterVisit":1,"clusterId":"1","size":1,"switch":1,"address":[{"host":"127.0.0.1","port":"46802"},{"host":"127.0.0.1","port":"46802"}]}
-```
-
-### Send Message
-```java
-    public void sendTcpMessage(DefaultMessageSender sender, String 
inlongGroupId,
-            String inlongStreamId, String messageBody, long dt) throws 
Exception {
-      SendResult result = 
sender.sendMessage(messageBody.getBytes("utf8"),inlongGroupId, inlongStreamId,
-             0, String.valueOf(dt), 20,TimeUnit.SECONDS);
-      logger.info("messageSender {} ", result);
-    }
-```
-
-The parameter description is as follows:
-
-| parameter name         | type     | instruction                             |
-|------------------------|----------|--------------------------------------------|
-| sender                 | HttpProxySender   | The sender created in the first 
step                  |
-| inlongGroupId          | String   | inglongGroupId                           
  |
-| inlongStreamId         | String   | inlongStreamId                           
  |
-| messageBody            | String   | Sent message content                     
           |
-| dt                     | long     | timestamp                               |
-
-## HTTP Example
-
-### Create MessageSender
-```java
-    public HttpProxySender getMessageSender(String localIP, String 
inLongManagerAddr, String inLongManagerPort,
-            String netTag, String dataProxyGroup, boolean isLocalVisit, 
boolean isReadProxyIPFromLocal,
-            String configBasePath) {
-         ProxyClientConfig proxyConfig = null;
-         HttpProxySender sender = null;
-         try {
-              proxyConfig = new ProxyClientConfig(localIP, isLocalVisit, 
inLongManagerAddr,
-                        Integer.valueOf(inLongManagerPort),
-                        dataProxyGroup, netTag);
-             proxyConfig.setGroupId(dataProxyGroup);
-             proxyConfig.setConfStoreBasePath(configBasePath);
-             proxyConfig.setReadProxyIPFromLocal(isReadProxyIPFromLocal);
-             proxyConfig.setDiscardOldMessage(true);
-             sender = new HttpProxySender(proxyConfig);
-         } catch (ProxysdkException e) {
-             e.printStackTrace();
-         } catch (Exception e) {
-             e.printStackTrace();
-         }
-        return sender;
-    }
-```
-
-The parameter description is as follows:
-
-| parameter name         | type     | instruction                              
        |
-|------------------------|----------|--------------------------------------------|
-| inLongManagerAddr      | String   | inlong admin server address              
  |
-| inLongManagerPort      | String   | inlong admin server port                 
  |
-| netTag                 | String   | Network label, not used yet, you can 
pass an empty string   |
-| dataProxyGroup         | String   | dataProxy group name, the name used for 
local configuration when the user enables local configuration         |
-| isLocalVisit           | boolean  | Whether to use local configuration, true 
use https to access the console, false use http to request the console|
-| isReadProxyIPFromLocal | boolean  | Whether to obtain the address 
information of the Dataproxy server from the local configuration file, local 
self-test, can be set to true if the management console cannot be accessed|
-| configBasePath         | String   | The path of the local configuration 
file. The default is ./inlong. When isReadProxyIPFromLocal is true, the 
configuration file is searched from this directory.|                            
     |
-
-
-When isReadProxyIPFromLocal is set true, the configuration information of 
Dataproxy will be obtained from the local configuration file.
-
-The path to the local file is:
-```
-    ${configBasePath}
-```
-The file name is:
-```
-    ${dataProxyGroup}.local<br/>
-```
-For example:
-```
-    configBasePath = /data/inlong
-    dataProxyGroup = inlong_test
-```
-
-Then the full path name of the local file is:
-```
-    /data/inlong/inlong_test.local
-```
-
-The file configuration content is (json format), where host is the address of 
the DataProxy server, and port is the corresponding port, which requires at 
least two configurations (the same two items can be configured):
-```json
-    
{"isInterVisit":1,"clusterId":"1","size":1,"switch":1,"address":[{"host":"127.0.0.1","port":"46802"},{"host":"127.0.0.1","port":"46802"}]}
-```
-
-### Send Message
-```java
-    public void sendHttpMessage(HttpProxySender sender, String inlongGroupId,
-            String inlongStreamId, String messageBody) throws Exception {
-        List<String> bodyList = new ArrayList<>();
-        bodyList.add(messageBody);
-        sender.asyncSendMessage(bodyList, inlongGroupId, inlongStreamId, 
System.currentTimeMillis(),
-             20, TimeUnit.SECONDS, new MyMessageCallBack());
-    }
-```
-The parameter description is as follows:
-
-| parameter name         | type    | instruction                               
     |
-|------------------------|----------|--------------------------------------------|
-| sender                 | HttpProxySender   | The sender created in the first 
step                  |
-| inlongGroupId          | String   | inglongGroupId                           
  |
-| inlongStreamId         | String   | inlongStreamId                           
  |
-| messageBody            | String   | Sent message content                     
           |
-
-## UDP Example
-inlong-dataproxy-sdk does not support sending messages of UDP protocol. If 
users need it, they need to assemble them according to the message assembly 
method in SDK.
-Organize binary arrays and send them in upd mode. For specific examples, refer 
to the relevant example codes in inlong-sdk/dataporxy-sdk.
\ No newline at end of file
diff --git a/docs/sdk/dataproxy-sdk/http.md b/docs/sdk/dataproxy-sdk/http.md
new file mode 100644
index 0000000000..a1868982bd
--- /dev/null
+++ b/docs/sdk/dataproxy-sdk/http.md
@@ -0,0 +1,114 @@
+---
+title: HTTP 上报
+sidebar_position: 3
+---
+
+## 新建实时同步任务
+在 Dashboard 或者通过命令行工具创建任务,数据源类型使用 `Auto Push` (自主推送)。
+
+## 方式一:调用 URL 上报
+```bash
+curl -X POST -d 
'groupId=give_your_group_id&streamId=give_your_stream_id&dt=data_time&body=give_your_data_body&cnt=1'
 http://dataproxy_url:46802/dataproxy/message
+```
+- 参数说明:
+
+| 参数       | 含义       | 备注  |
+|----------|----------|-----|
+| groupId  | 数据流组 id  |     |
+| streamId | 数据流 ID   |     |
+| body     | 推送的数据内容  |     |
+| dt       | 推送的数据时间  |     |
+| cnt      | 推送条数     |     |
+
+- 返回值:
+
+| 返回码 | 含义  |
+|-----|-----|
+| 1   | 成功  |
+| 非1  | 失败  |
+
+## 方式二:封装 HTTP Client(Java)
+需要 `httpclient`、`commons-lang3`、`jackson-databind`,代码示例:
+```java
+public class DataPush {
+
+    private static CloseableHttpClient httpClient;
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+    private final Random rand = new Random();
+
+    private String sendByHttp(List<String> bodies, String groupId, String 
streamId, long dataTime,
+            long timeout, TimeUnit timeUnit, List<String> addresses) throws 
Exception {
+        if (null == addresses || addresses.isEmpty()) {
+            throw new RuntimeException("addresses are null");
+        }
+        HttpPost httpPost = null;
+        CloseableHttpResponse response = null;
+        try {
+            if (httpClient == null) {
+                httpClient = constructHttpClient(timeout, timeUnit);
+            }
+            int randomNum = rand.nextInt((addresses.size() - 1) + 1);
+            String url = "http://"; + addresses.get(randomNum) + 
"/dataproxy/message";
+
+            httpPost = new HttpPost(url);
+            httpPost.setHeader(HttpHeaders.CONNECTION, "close");
+            httpPost.setHeader(HttpHeaders.CONTENT_TYPE, 
"application/x-www-form-urlencoded");
+            ArrayList<BasicNameValuePair> contents = getContents(bodies, 
groupId, streamId, dataTime);
+            String s = URLEncodedUtils.format(contents, 
StandardCharsets.UTF_8);
+            httpPost.setEntity(new StringEntity(s));
+
+            response = httpClient.execute(httpPost);
+            String returnStr = EntityUtils.toString(response.getEntity());
+
+            if (StringUtils.isNotBlank(returnStr) && 
response.getStatusLine().getStatusCode() == 200) {
+                JsonNode jsonNode = OBJECT_MAPPER.readTree(returnStr);
+                if (jsonNode.has("code")) {
+                    int code = jsonNode.get("code").asInt();
+                    if (code == 1) {
+                        return "success";
+                    } else {
+                        return "fail";
+                    }
+                }
+
+            } else {
+                throw new Exception("exception to get response from request " 
+ returnStr + " "
+                        + response.getStatusLine().getStatusCode());
+            }
+
+        } finally {
+            if (httpPost != null) {
+                httpPost.releaseConnection();
+            }
+            if (response != null) {
+                response.close();
+            }
+        }
+        return "fail";
+    }
+
+    private static synchronized CloseableHttpClient constructHttpClient(long 
timeout, TimeUnit timeUnit) {
+        if (httpClient != null) {
+            return httpClient;
+        }
+        long timeoutInMs = timeUnit.toMillis(timeout);
+        RequestConfig requestConfig = RequestConfig.custom()
+                .setConnectTimeout((int) timeoutInMs)
+                .setSocketTimeout((int) timeoutInMs).build();
+        HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
+        httpClientBuilder.setDefaultRequestConfig(requestConfig);
+        return httpClientBuilder.build();
+    }
+
+    private static ArrayList<BasicNameValuePair> getContents(List<String> 
bodies,
+            String groupId, String streamId, long dt) {
+        ArrayList<BasicNameValuePair> params = new 
ArrayList<BasicNameValuePair>();
+        params.add(new BasicNameValuePair("groupId", groupId));
+        params.add(new BasicNameValuePair("streamId", streamId));
+        params.add(new BasicNameValuePair("dt", String.valueOf(dt)));
+        params.add(new BasicNameValuePair("body", StringUtils.join(bodies, 
"\n")));
+        params.add(new BasicNameValuePair("cnt", 
String.valueOf(bodies.size())));
+        return params;
+    }
+}
+```
\ No newline at end of file
diff --git a/docs/sdk/dataproxy-sdk/java.md b/docs/sdk/dataproxy-sdk/java.md
new file mode 100644
index 0000000000..82b17a0184
--- /dev/null
+++ b/docs/sdk/dataproxy-sdk/java.md
@@ -0,0 +1,107 @@
+---
+title: Java SDK
+sidebar_position: 2
+---
+
+import {siteVariables} from '../../version';
+
+## 新建实时同步任务
+在 Dashboard 或者通过命令行工具创建任务,数据源类型使用 `Auto Push` (自主推送)。
+
+## 引入 Java SDK
+需要在项目中包含 SDK 的头文件和库,进行 SDK 的使用。头文件和库提供以下两种获取方式:
+- 获取源码自行编译并将 SDK 
包部署到本地仓库,见[如何编译](https://inlong.apache.org/docs/next/quick_start/how_to_build/);
+- 直接引用Apache仓库里的已有库,见
+<pre><code parentName="pre">
+{`<dependency>
+    <groupId>org.apache.inlong</groupId>
+    <artifactId>dataproxy-sdk</artifactId>
+    <version>${siteVariables.inLongVersion}</version>
+</dependency>
+`}
+</code></pre>
+
+## 数据上报流程
+引入 SDK 
后,通过实例化一个[MessageSender](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/MessageSender.java)接口对象后,调用相关的同步(sendMessage())或
 异步(asyncSendMessage())接口来完成单条或多条(批量)数据的上报任务。发送Demo可参考 
[TcpClientExample.java](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/example/TcpClientExample.java)。
+整体流程包括以下三个步骤:
+
+### 初始化 SDK
+从Demo示例代码我们可以看到,客户端初始化主要是在 `getMessageSender()` 函数中完成:
+```java
+public DefaultMessageSender getMessageSender(String localIP, String 
inLongManagerAddr, String inLongManagerPort, String netTag, String 
dataProxyGroup, boolean isLocalVisit, boolean isReadProxyIPFromLocal, String 
configBasePath, int msgType) {
+    ProxyClientConfig dataProxyConfig = null;
+    DefaultMessageSender messageSender = null;
+    try {
+        // 初始化客户端配置,其中“test”,“123456”是需要认证的用户名和密码,实际使用时需要根据环境配置进行更替
+        dataProxyConfig = new ProxyClientConfig(localIP, isLocalVisit, 
inLongManagerAddr, Integer.valueOf(inLongManagerPort), dataProxyGroup, netTag, 
"test", "123456");
+               // 设置配置信息的本地保存路径,该设置可选,缺省情况下 SDK 
会在当前用户工作目录下构造一个"/.inlong/"目录存储配置数据
+               if (StringUtils.isNotEmpty(configBasePath)) {
+            dataProxyConfig.setConfStoreBasePath(configBasePath);
+        }
+               // 设置是否允许使用本地保存的配置信息,该设置可选,缺省不启用
+        dataProxyConfig.setReadProxyIPFromLocal(isReadProxyIPFromLocal);
+               // 初始化MessageSender对象,异常将抛异常
+        messageSender = 
DefaultMessageSender.generateSenderByClusterId(dataProxyConfig);
+               // 设置 SDK 与DataProxy间消息发送的消息类型,该设置可选,缺省默认为7以二进制形式进行数据发送
+        messageSender.setMsgtype(msgType);
+    } catch (Exception e) {
+        logger.error("getMessageSender has exception e = {}", e);
+    }
+       // 返回初始化结果
+    return messageSender;
+}
+```
+
+### 调用发送接口进行数据上报
+SDK 的数据发送接口时线程安全的,支持以同步或者异步模式发送单条或多条消息。Demo里采用的是单条同步消息发送,并且消息中不包含属性信息:
+```java
+public void sendTcpMessage(DefaultMessageSender sender, String inlongGroupId, 
String inlongStreamId, String messageBody, long dt) {
+    SendResult result = null;
+    try {
+        // 以同步模式发送单条消息,不携带属性信息
+        result = sender.sendMessage(messageBody.getBytes("utf8"), 
inlongGroupId, inlongStreamId,
+                0, String.valueOf(dt), 20, TimeUnit.SECONDS);
+    } catch (UnsupportedEncodingException e) {
+        e.printStackTrace();
+    }
+    logger.info("messageSender {}", result);
+}
+```
+
+大家还可以根据业务需要选择不同的发送接口进行数据上报,具体接口细节可以参考[MessageSender](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/MessageSender.java)接口文件中的定义,里面有详细的接口使用及参数定义介绍,这里不做额外说明。
+
+### 关闭 SDK 
+Demo 里没有实现关闭操作,使用时我们需要调用MessageSender接口对象的close()函数关闭数据上报服务:
+
+# 注意事项
+- 
MessageSender接口对象是基于GroupID进行初始化,因而每个MessageSender对象基于GroupID区别使用,同一个进程内允许创建多个MessageSender对象;
+- SDK 
封装了TCP、HTTP、UDP共三种不同的网络交互方式,并在[example](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/example)目录里给出了3种方式的不同示例(参考TcpClientExample.java,HttpClientExample.java,UdpClientExample.java实现),业务可以根据自身需要来初始化不同的MessageSender对象;
+- SDK 中包含了复杂的网络交互,使用时需要将 SDK 
作为常驻服务对象来使用,避免同个进程中途频繁地初始化和关闭MessageSender对象(重复初始化和关闭会带来很大的资源开销,并且影响数据上报的时效性);
+- SDK 不对发送失败的消息做重发处理,用户在使用 SDK 上报数据时遇到发送失败,业务要根据自身数据要求来决定是否重发消息,避免数据丢失。
+
+## 错误码介绍
+常见result会有以下几种值
+
+| 返回值                                   | 含义                           | 备注    
                                        |
+|---------------------------------------|------------------------------|-----------------------------------------------|
+| SendResult.OK                         | 消息发送成功                       |       
                                        |
+| SendResult.TIMEOUT                    | 请求响应超时                       |       
                                        |
+| SendResult.CONNECTION_BREAK           | 链接被断开                        |       
                                        |
+| SendResult.THREAD_INTERRUPT           | 中断                           |       
                                        |
+| SendResult.ASYNC_CALLBACK_BUFFER_FULL | SDK 待回包请求消息满                 | 
这种情况一般为前端生产数据的速度超过服务端的响应速度导致,建议发送时适当sleep避免阻塞 |
+| SendResult.NO_CONNECTION              | 没有可用链接                       | 
这种情况建议业务增大可用链接数                               |
+| SendResult.INVALID_DATA               | 数据无效,通过HTTP上报数据DataProxy返回失败 |       
                                        |
+| SendResult.INVALID_ATTRIBUTES         | 发送的数据包不合理,比如为空数据包或包含了系统预定义属性 |       
                                        |
+| SendResult.UNKOWN_ERROR               | 未知错误                         |       
                                        |
+
+## ProxyClientConfig相关配置项介绍
+
+| 参数设置                                                      | 说明               
                                                                                
                 | 调整建议                                                         
                   |
+|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
+| setAliveConnections(int aliveConnections)                 | 
设置DataProxy连接数大小;默认值:3                                                          
                                  | 
1)数据量大或对时延敏感,适当增大该参数;2)根据DataProxy集群大小,适当调整该参数,比如集群规模为30,该值可设为5~10;3)现网经验值15~20 
|
+| setTotalAsyncCallbackSize(int asyncCallbackSize)          | 设置异步发送时 SDK 
内部缓冲队列大小;缓存队列用于暂存已发送但未收到服务端Ack的数据包。当缓冲数据达到该值,业务继续异步上报数据,会收到ASYNC_CALLBACK_BUFFER_FULL异常;默认值:
 50000    | 1)通常无需调整该参数;2)数据量非常大或者DataProxy服务端负载较高情况下,可适当增大,注意不要太大导致OOM         
            |
+| setConnectTimeoutMillis(long connectTimeoutMillis)        | 
设置连接超时时长,单位ms,缺省40000                                                           
                                  | 根据实际环境需要设置                                  
                                    |
+| setRequestTimeoutMillis(long requestTimeoutMillis)        | 
设置请求超时时长,单位ms,缺省40000                                                           
                                  | 根据需要调整设置                                    
                                    |
+| setMaxTimeoutCnt(int maxTimeoutCnt)                       | 
设置单个DataProxy连接超时断连次数; SDK 
内部会对超时未收到Ack的DataProxy连接进行计数,短时间内同一个连接超时数达到该值,会主动断开该连接,选择其他DataProxy创建新的连接进行数据发送。默认值:3
 | 如果DataProxy集群本身规模较小,可适当调大该参数,避免短时间频繁断连                                       
   |
+| setManagerConnectionTimeout(int managerConnectionTimeout) | 设置 SDK 
连接Manager的超时时长,单位ms,默认10000ms                                                   
                           | 1)网络环境不好的情况下可适当增大该值;2)客户端解析域名时间较长情况下可适当增大该值        
                             |
+| setManagerSocketTimeout(int managerSocketTimeout)         | 设置 SDK 
从Manager连接读取DataProxy列表的超时时间,单位ms,默认值30000                                      
                           | 网络环境不好的情况下可适当增大该值                                  
                             |
\ No newline at end of file
diff --git a/docs/sdk/dataproxy-sdk/overview.md 
b/docs/sdk/dataproxy-sdk/overview.md
deleted file mode 100644
index d254a6b32d..0000000000
--- a/docs/sdk/dataproxy-sdk/overview.md
+++ /dev/null
@@ -1,57 +0,0 @@
----
-title: Overview
----
-
-DataProxy supports multi-data format for access, and users can assemble and 
send data according to the format recognized by DataProxy (such as six-segment 
protocol, digital protocol, etc.).
-Alternatively, use the SDK provided by DataProxy for data access.
-The DataProxy SDK provides multi-features such as load balance and dynamically 
updating the proxy list, which can ensure the reliability of access data, 
simplify the user's access logic, and reduce the user's access difficulty. It 
is recommended to use the SDK method to access.
-
-## Functions
-
-|  function   | description  |
-|  ----  | ----  |
-| Package function (new)  | The user data is packaged and sent to the proxy in 
a packet format recognized by the proxy (such as six-segment protocol, digital 
protocol, etc.)|
-| Compression function| Before sending proxy, compress user data to reduce 
network bandwidth usage|
-| Maintain proxy list| Get the proxy list every five minutes to detect whether 
there is a proxy machine on the operation and maintenance side; automatically 
remove unavailable connections every 20s to ensure that the connected proxy can 
operate normally |
-| Indicator statistics (new)| Increase the indicator of business minute-level 
sending volume (interface level)|
-| Load balancing (new)| Use the new strategy to load balance the sent data 
among multiple proxies, instead of relying on simple random + polling mechanism 
to ensure|
-| proxy list persistence (new)| Persist the proxy list according to the 
business group id to prevent the configuration center from failing to send data 
when the program starts
-
-
-## Data transmission
-
-### Synchronous batch function
-```
-    public SendResult sendMessage(List<byte[]> bodyList, String groupId, 
String streamId, long dt, long timeout, TimeUnit timeUnit)
-
-    Parameter Description
-
-    bodyListIt is a collection of multiple pieces of data that users need to 
send. The total length is recommended to be less than 512k. groupId represents 
the service id, and streamId represents the interface id. dt represents the 
time stamp of the data, accurate to the millisecond level. It can also be set 
to 0 directly, and the api will get the current time as its timestamp in the 
background. timeout & timeUnit: These two parameters are used to set the 
timeout time for sending data, a [...]
-```
-
-### Synchronize a single function
-```
-    public SendResult sendMessage(byte[] body, String groupId, String 
streamId, long dt, long timeout, TimeUnit timeUnit)
-
-    Parameter Description
-
-    body is the content of a single piece of data that the user wants to send, 
and the meaning of the remaining parameters is basically the same as the batch 
sending interface.
-```
-
-### Asynchronous batch function
-```
-    public void asyncSendMessage(SendMessageCallback callback, List<byte[]> 
bodyList, String groupId, String streamId, long dt, long timeout,TimeUnit 
timeUnit)
-
-    Parameter Description
-
-    SendMessageCallback is a callback for processing messages. The bodyList is 
a collection of multiple pieces of data that users need to send. The total 
length of multiple pieces of data is recommended to be less than 512k. groupId 
is the service id, and streamId is the interface id. dt represents the time 
stamp of the data, accurate to the millisecond level. It can also be set to 0 
directly, and the api will get the current time as its timestamp in the 
background. timeout and timeUnit  [...]
-```
-
-### Asynchronous single function
-```
-    public void asyncSendMessage(SendMessageCallback callback, byte[] body, 
String groupId, String streamId, long dt, long timeout, TimeUnit timeUnit)
-
-    Parameter Description
-
-    The body is the content of a single message, and the meaning of the 
remaining parameters is basically the same as the batch sending interface
-```
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/cpp.md 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/cpp.md
new file mode 100644
index 0000000000..c3eca131c3
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/cpp.md
@@ -0,0 +1,95 @@
+---
+title: C++ SDK
+sidebar_position: 1
+---
+
+import {siteVariables} from '../../version';
+
+## 新建实时同步任务
+在 Dashboard 或者通过命令行工具创建任务,数据源类型使用 `Auto Push` (自主推送)。
+
+## 引入 C++ SDK
+需要在项目中包含SDK的头文件和库,进行 SDK 的使用。头文件和库提供可以从源码自行编译,见 [SDK 
编译使用](https://github.com/apache/inlong/tree/master/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp)。
+
+## 数据上报流程
+引入 SDK 后,可以通过调用 SDK 的`send`相关接口进行单条(批量)数据的上报,发送 demo 可参考 
[send_demo.cc](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/release/demo/send_demo.cc)。整体流程包括以下三个步骤:
+
+### 初始化 SDK
+SDK 支持对象实例化和配置文件初始化两种方式(二选一即可):
+- 对象实例初始化
+首先初始化客户端配置,然后调用初始化接口:
+``` 
+// 初始化客户端配置
+ClientConfig client;
+// 设置client相关配置参数,其中proxy_URL_为必选参数(格式如下),其他参数详见client_config.h文件
+client.proxy_cluster_URL_="http://{Manager 
url}/inlong/manager/openapi/dataproxy/getIpList";
+// 初始化SDK, 返回值为零表示初始化成功,非零表示失败
+int32_t result = tc_api_init(client);
+```
+
+- 配置文件初始化
+配置文件采用 json 格式,见[配置文件说明](#附录:配置文件说明),通过配置文件初始化 SDK:
+```
+// 初始化SDK,参数为配置文件的路径名;返回值为零表示初始化成功
+int32_t result = tc_api_init("/home/conf/config.json");
+```
+
+### 调用发送接口进行数据上报
+SDK 
支持单条(推荐)和批量发送,二者发送过程均为异步模式,数据上报接口是线程安全的。在进行数据上报前,可设置回调函数在数据发送失败时进行回调处理,回调函数签名如下:
+```
+int32_t callBackFunc(const char* inlong_group_id, const char* 
inlong_stream_id, const char* msg, int32_t msg_len, const int64_t report_time, 
const char* client_ip);
+```
+
+- 单条数据数据上报接口
+```
+// 返回值:零表示发送成功,非零表示失败,具体异常返回值详见tc_api.h中的SDKInvalidReuslt
+int32_t tc_api_send(const char* inlong_group_id, const char* inlong_stream_id, 
const char* msg, int32_t msg_len, UserCallBack call_back = NULL);
+```
+
+- 批量数据上报接口
+```
+int32_t tc_api_send_batch(const char* inlong_group_id, const char* 
inlong_stream_id, const char** msg_list, int32_t msg_cnt, UserCallBack 
call_back = NULL);
+```
+
+### 关闭 SDK
+调用 close 接口关闭 SDK:
+```
+// 返回值为零表示关闭成功,后续无法再进行数据上报
+// max_waitms:关闭SDK前的等待最大毫秒数,等待SDK内部数据发送完成
+int32_t tc_api_close(int32_t max_waitms);
+```
+
+## 注意事项
+- SDK 的初始化和关闭都是进程级别的,只需初始化一次,fork 的子进程中需调用初始化接口后再进行数据上报;
+- 建议采用将 SDK 作为常驻服务来进行数据上报,避免同个进程中途频繁地初始化和关闭,重复初始化和关闭会带来更多开销;
+- SDK 发送是异步进行的,返回值为 0 表示数据成功存入了 SDK 
内部缓冲区,等待网络发送。如果`inlong_group_id`本身配置有误或者网络异常,也会导致数据发送失败,所以建议用户在调用该接口时设置回调,数据多次重试发送仍失败时执行回调。
+
+## 附录:配置文件说明
+配置文件格式和重要参数如下:
+```json
+{
+"init-param": {
+"thread_num": 5, // 网络收发线程的数量
+"enable_pack": true, // 是否多条打包发送
+"pack_size": 409600, // 数据达到pack_size大小,进行打包发送,单位字节
+"ext_pack_size": 409600, // 单条数据最大长度,单位字节
+"enable_zip": true, // 是否进行数据压缩
+"min_ziplen": 4096, // 最小压缩长度,单位字节
+"enable_retry": true, // 发送失败是否进行重试
+"retry_ms": 10000, // 重试间隔时间,单位毫秒
+"retry_num": 3, // 发送失败最大重试次数
+"max_active_proxy": 4, // tcp最大连接数,用于网络数据收发
+"max_buf_pool": 548576000, // 单个数据缓存区大小,单位字节
+"buffer_num_per_groupId": 3, // 每个groupid的数据缓存区个数
+"log_num": 10, // 最大日志文件数
+"log_size": 10, // 单个日志大小限制,单位MB
+"log_level": 3, // 日志级别,trace(4)>debug(3)>info(2)>warn(1)>error(0)
+"log_file_type": 2, // 日志输出,2->文件, 1->控制台
+"log_path": "./", // 日志路径
+"proxy_cfg_preurl": 
"http://127.0.0.1:8099/inlong/manager/openapi/dataproxy/getIpList";, // 
访问manager的url
+"need_auth": false, // 是否需要认证
+"auth_id": "admin", // 认证id
+"auth_key": "adminKey" // 认证key
+}
+}
+```
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/example.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/example.md
deleted file mode 100644
index e7592e3b25..0000000000
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/example.md
+++ /dev/null
@@ -1,192 +0,0 @@
----
-title: 示例
-sidebar_position: 2
----
-
-import {siteVariables} from '../../version';
-
-## 总览
-Inlong-dataproxy-sdk 提供 TCP、HTTP两种协议的接入 api ,使用 TCP 或者 HTTP 接入时需要保证 Dataproxy 
服务器端,有对应的协议的接入配置(即对应的 Source 服务配置)。如果,需要使用 UDP 方式接入,
-需要自己按照 TCP 传输的 bytes 数组格式进行组包,采用 UDP 协议发送到 dataproxy 服务器,服务器端采用与TCP一样的方式对接。
-此外,在 Inlong-dataproxy-sdk 中的 example 目录下提供了 TCP、HTTP、UDP 
三种协议的接入演示代码,大家在接入时可以参考。
-
-Api 详情,请查看[总览](./overview)
-
-## 增加依赖
-<pre><code parentName="pre">
-{`<dependency>
-    <groupId>org.apache.inlong</groupId>
-    <artifactId>dataproxy-sdk</artifactId>
-    <version>${siteVariables.inLongVersion}</version>
-</dependency>
-`}
-</code></pre>
-  
-## TCP 示例
-
-### 创建 messageSender
-```java
-    public DefaultMessageSender getMessageSender(String localIP, String 
inLongManagerAddr, String inLongManagerPort,
-            String netTag, String dataProxyGroup, boolean isLocalVisit, 
boolean isReadProxyIPFromLocal,
-            String configBasePath, int msgType) {
-        ProxyClientConfig dataProxyConfig = null;
-        DefaultMessageSender messageSender = null;
-        try {
-            dataProxyConfig = new ProxyClientConfig(localIP, isLocalVisit, 
inLongManagerAddr,
-                    Integer.valueOf(inLongManagerPort), dataProxyGroup, 
netTag);
-            if (StringUtils.isNotEmpty(configBasePath)) {
-                dataProxyConfig.setConfStoreBasePath(configBasePath);
-            }
-            dataProxyConfig.setReadProxyIPFromLocal(isReadProxyIPFromLocal);
-            messageSender = 
DefaultMessageSender.generateSenderByClusterId(dataProxyConfig);
-            messageSender.setMsgtype(msgType);
-        } catch (Exception e) {
-            logger.error("getMessageSender has exception e = {}", e);
-        }
-        return messageSender;
-    }
-```
-参数说明如下:
-
-| 参数名称                 | 类型     | 说明                                        |
-|------------------------|----------|--------------------------------------------|
-| inLongManagerAddr      | String   | inlong 管理台地址                             
|
-| inLongManagerPort      | String   | inlong 管理台端口                             
|
-| netTag                 | String   | 网络标签,暂未使用,可以传空字符串                |
-| dataProxyGroup         | String   | dataProxy 组名称,用户在启用本地配置的时候,用于本地配置的名称     
    |
-| isLocalVisit           | boolean  | 是否使用本地配置, true 使用 https 访问管理台,false 使用 
http 请求管理台|
-| isReadProxyIPFromLocal | boolean  | 是否从本地配置文件中获取 Dataproxy 
服务器地址信息,本地自测,不能访问管理台的情况下可以配置为 true|
-| configBasePath         | String   | 本地配置文件的路径 默认 
./inlong,isReadProxyIPFromLocal 为 true 时从这个目录查找配置文件/                            
     |
-| msgtype                | int      | 
消息类型,取值(3,5,7,8),建议使用7,每种消息类型代表一种传递过程中消息的拼装协议,具体请参照SDK的代码实现|
-
-当 isReadProxyIPFromLocal 为 true 的时候, 会从本地配置文件中获取 Dataproxy 的配置信息。
-
-本地文件的路径为:
-```
-    ${configBasePath}
-```
-
-文件名称为:
-```
-    ${dataProxyGroup}.local
-```
-例如:
-```
-    configBasePath = /data/inlong
-    dataProxyGroup = inlong_test
-```
-则本地文件的全路径名称为:
-```
-    /data/inlong/inlong_test.local
-```
-
-文件配置内容为( json 格式),其中 host 为 DataProxy 服务器地址,port为对应的端口,这需要至少配置两个(可以配置为相同的两项):
-```json
-    
{"isInterVisit":1,"clusterId":"1","size":1,"switch":1,"address":[{"host":"127.0.0.1","port":"46802"},{"host":"127.0.0.1","port":"46802"}]}
-```
-
-### 发送消息
-```java
-    public void sendTcpMessage(DefaultMessageSender sender, String 
inlongGroupId,
-            String inlongStreamId, String messageBody, long dt) throws 
Exception {
-     SendResult result = 
sender.sendMessage(messageBody.getBytes("utf8"),inlongGroupId, inlongStreamId,
-             0, String.valueOf(dt), 20,TimeUnit.SECONDS);
-     logger.info("messageSender {} ", result);
-    }
-```
-
-参数说明如下:
-
-| 参数名称                 | 类型     | 说明                                        |
-|------------------------|----------|--------------------------------------------|
-| sender                 | HttpProxySender   | 第一步创建的 sender                  |
-| inlongGroupId          | String   | inglongGroupId                           
  |
-| inlongStreamId         | String   | inlongStreamId                           
  |
-| messageBody            | String   | 发送的消息内容                                |
-| dt                     | long     | 时间戳                               |
-
-## HTTP 示例
-
-### 创建 messageSender
-```java
-    public HttpProxySender getMessageSender(String localIP, String 
inLongManagerAddr, String inLongManagerPort,
-            String netTag, String dataProxyGroup, boolean isLocalVisit, 
boolean isReadProxyIPFromLocal,
-            String configBasePath) {
-         ProxyClientConfig proxyConfig = null;
-         HttpProxySender sender = null;
-         try {
-             proxyConfig = new ProxyClientConfig(localIP, isLocalVisit, 
inLongManagerAddr,
-                        Integer.valueOf(inLongManagerPort),
-                        dataProxyGroup, netTag);
-             proxyConfig.setGroupId(dataProxyGroup);
-             proxyConfig.setConfStoreBasePath(configBasePath);
-             proxyConfig.setReadProxyIPFromLocal(isReadProxyIPFromLocal);
-             proxyConfig.setDiscardOldMessage(true);
-             sender = new HttpProxySender(proxyConfig);
-         } catch (ProxysdkException e) {
-             e.printStackTrace();
-         } catch (Exception e) {
-             e.printStackTrace();
-         }
-         return sender;
-    }
-```
-参数说明如下:
-
-| 参数名称                 | 类型     | 说明                                        |
-|------------------------|----------|--------------------------------------------|
-| inLongManagerAddr      | String   | inlong 管理台地址                             
|
-| inLongManagerPort      | String   | inlong 管理台端口                             
|
-| netTag                 | String   | 网络标签,暂未使用,可以传空字符串                |
-| dataProxyGroup         | String   | dataProxy 组名称,用户在启用本地配置的时候,用于本地配置的名称     
    |
-| isLocalVisit           | boolean  | 是否使用本地配置, true 使用 https 访问管理台,false 使用 
http 请求管理台|
-| isReadProxyIPFromLocal | boolean  | 是否从本地配置文件中获取 Dataproxy 
服务器地址信息,本地自测,不能访问管理台的情况下可以配置为 true|
-| configBasePath         | String   | 本地配置文件的路径 默认 
./inlong,isReadProxyIPFromLocal 为 true 时从这个目录查找配置文件/                            
     |
-
-当 isReadProxyIPFromLocal 为 true 的时候, 会从本地配置文件中获取 Dataproxy 的配置信息。
-
-本地文件的路径为
-```
-    ${configBasePath}
-```
-文件名称为:
-```
-    ${dataProxyGroup}.local
-```
-例如:
-```
-    configBasePath = /data/inlong
-    dataProxyGroup = inlong_test
-```
-
-则本地文件的全路径名称为:
-```
-    /data/inlong/inlong_test.local
-```
-文件配置内容为( json 格式),其中 host 为 DataProxy 服务器地址,port 为对应的端口,这需要至少配置两个(可以配置为相同的两项):
-```json
-    
{"isInterVisit":1,"clusterId":"1","size":1,"switch":1,"address":[{"host":"127.0.0.1","port":"46802"},{"host":"127.0.0.1","port":"46802"}]}
-```
-
-### 发送消息
-```java
-    public void sendHttpMessage(HttpProxySender sender, String inlongGroupId,
-            String inlongStreamId, String messageBody) throws Exception {
-        List<String> bodyList = new ArrayList<>();
-        bodyList.add(messageBody);
-        sender.asyncSendMessage(bodyList, inlongGroupId, inlongStreamId, 
System.currentTimeMillis(),
-             20, TimeUnit.SECONDS, new MyMessageCallBack());
-    }
-```
-参数说明如下:
-
-| 参数名称                 | 类型     | 说明                                        |
-|------------------------|----------|--------------------------------------------|
-| sender                 | HttpProxySender   | 第一步创建的 sender                  |
-| inlongGroupId          | String   | inglongGroupId                           
  |
-| inlongStreamId         | String   | inlongStreamId                           
  |
-| messageBody            | String   | 发送的消息内容                                |
-
-## UDP 示例
-Inlong-dataproxy-sdk 不支持发送 UDP 协议的消息,如果用户需要,需要自己按照 SDK 中的消息拼装方式,
-组织二进制数组,按照 UDP方式发送,具体示例参照 inlong-sdk/dataporxy-sdk 中的相关的 example 代码。
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/http.md 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/http.md
new file mode 100644
index 0000000000..a1868982bd
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/http.md
@@ -0,0 +1,114 @@
+---
+title: HTTP 上报
+sidebar_position: 3
+---
+
+## 新建实时同步任务
+在 Dashboard 或者通过命令行工具创建任务,数据源类型使用 `Auto Push` (自主推送)。
+
+## 方式一:调用 URL 上报
+```bash
+curl -X POST -d 
'groupId=give_your_group_id&streamId=give_your_stream_id&dt=data_time&body=give_your_data_body&cnt=1'
 http://dataproxy_url:46802/dataproxy/message
+```
+- 参数说明:
+
+| 参数       | 含义       | 备注  |
+|----------|----------|-----|
+| groupId  | 数据流组 id  |     |
+| streamId | 数据流 ID   |     |
+| body     | 推送的数据内容  |     |
+| dt       | 推送的数据时间  |     |
+| cnt      | 推送条数     |     |
+
+- 返回值:
+
+| 返回码 | 含义  |
+|-----|-----|
+| 1   | 成功  |
+| 非1  | 失败  |
+
+## 方式二:封装 HTTP Client(Java)
+需要 `httpclient`、`commons-lang3`、`jackson-databind`,代码示例:
+```java
+public class DataPush {
+
+    private static CloseableHttpClient httpClient;
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+    private final Random rand = new Random();
+
+    private String sendByHttp(List<String> bodies, String groupId, String 
streamId, long dataTime,
+            long timeout, TimeUnit timeUnit, List<String> addresses) throws 
Exception {
+        if (null == addresses || addresses.isEmpty()) {
+            throw new RuntimeException("addresses are null");
+        }
+        HttpPost httpPost = null;
+        CloseableHttpResponse response = null;
+        try {
+            if (httpClient == null) {
+                httpClient = constructHttpClient(timeout, timeUnit);
+            }
+            int randomNum = rand.nextInt((addresses.size() - 1) + 1);
+            String url = "http://"; + addresses.get(randomNum) + 
"/dataproxy/message";
+
+            httpPost = new HttpPost(url);
+            httpPost.setHeader(HttpHeaders.CONNECTION, "close");
+            httpPost.setHeader(HttpHeaders.CONTENT_TYPE, 
"application/x-www-form-urlencoded");
+            ArrayList<BasicNameValuePair> contents = getContents(bodies, 
groupId, streamId, dataTime);
+            String s = URLEncodedUtils.format(contents, 
StandardCharsets.UTF_8);
+            httpPost.setEntity(new StringEntity(s));
+
+            response = httpClient.execute(httpPost);
+            String returnStr = EntityUtils.toString(response.getEntity());
+
+            if (StringUtils.isNotBlank(returnStr) && 
response.getStatusLine().getStatusCode() == 200) {
+                JsonNode jsonNode = OBJECT_MAPPER.readTree(returnStr);
+                if (jsonNode.has("code")) {
+                    int code = jsonNode.get("code").asInt();
+                    if (code == 1) {
+                        return "success";
+                    } else {
+                        return "fail";
+                    }
+                }
+
+            } else {
+                throw new Exception("exception to get response from request " 
+ returnStr + " "
+                        + response.getStatusLine().getStatusCode());
+            }
+
+        } finally {
+            if (httpPost != null) {
+                httpPost.releaseConnection();
+            }
+            if (response != null) {
+                response.close();
+            }
+        }
+        return "fail";
+    }
+
+    private static synchronized CloseableHttpClient constructHttpClient(long 
timeout, TimeUnit timeUnit) {
+        if (httpClient != null) {
+            return httpClient;
+        }
+        long timeoutInMs = timeUnit.toMillis(timeout);
+        RequestConfig requestConfig = RequestConfig.custom()
+                .setConnectTimeout((int) timeoutInMs)
+                .setSocketTimeout((int) timeoutInMs).build();
+        HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
+        httpClientBuilder.setDefaultRequestConfig(requestConfig);
+        return httpClientBuilder.build();
+    }
+
+    private static ArrayList<BasicNameValuePair> getContents(List<String> 
bodies,
+            String groupId, String streamId, long dt) {
+        ArrayList<BasicNameValuePair> params = new 
ArrayList<BasicNameValuePair>();
+        params.add(new BasicNameValuePair("groupId", groupId));
+        params.add(new BasicNameValuePair("streamId", streamId));
+        params.add(new BasicNameValuePair("dt", String.valueOf(dt)));
+        params.add(new BasicNameValuePair("body", StringUtils.join(bodies, 
"\n")));
+        params.add(new BasicNameValuePair("cnt", 
String.valueOf(bodies.size())));
+        return params;
+    }
+}
+```
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/java.md 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/java.md
new file mode 100644
index 0000000000..82b17a0184
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/java.md
@@ -0,0 +1,107 @@
+---
+title: Java SDK
+sidebar_position: 2
+---
+
+import {siteVariables} from '../../version';
+
+## 新建实时同步任务
+在 Dashboard 或者通过命令行工具创建任务,数据源类型使用 `Auto Push` (自主推送)。
+
+## 引入 Java SDK
+需要在项目中包含 SDK 的头文件和库,进行 SDK 的使用。头文件和库提供以下两种获取方式:
+- 获取源码自行编译并将 SDK 
包部署到本地仓库,见[如何编译](https://inlong.apache.org/docs/next/quick_start/how_to_build/);
+- 直接引用Apache仓库里的已有库,见
+<pre><code parentName="pre">
+{`<dependency>
+    <groupId>org.apache.inlong</groupId>
+    <artifactId>dataproxy-sdk</artifactId>
+    <version>${siteVariables.inLongVersion}</version>
+</dependency>
+`}
+</code></pre>
+
+## 数据上报流程
+引入 SDK 
后,通过实例化一个[MessageSender](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/MessageSender.java)接口对象后,调用相关的同步(sendMessage())或
 异步(asyncSendMessage())接口来完成单条或多条(批量)数据的上报任务。发送Demo可参考 
[TcpClientExample.java](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/example/TcpClientExample.java)。
+整体流程包括以下三个步骤:
+
+### 初始化 SDK
+从Demo示例代码我们可以看到,客户端初始化主要是在 `getMessageSender()` 函数中完成:
+```java
+public DefaultMessageSender getMessageSender(String localIP, String 
inLongManagerAddr, String inLongManagerPort, String netTag, String 
dataProxyGroup, boolean isLocalVisit, boolean isReadProxyIPFromLocal, String 
configBasePath, int msgType) {
+    ProxyClientConfig dataProxyConfig = null;
+    DefaultMessageSender messageSender = null;
+    try {
+        // 初始化客户端配置,其中“test”,“123456”是需要认证的用户名和密码,实际使用时需要根据环境配置进行更替
+        dataProxyConfig = new ProxyClientConfig(localIP, isLocalVisit, 
inLongManagerAddr, Integer.valueOf(inLongManagerPort), dataProxyGroup, netTag, 
"test", "123456");
+               // 设置配置信息的本地保存路径,该设置可选,缺省情况下 SDK 
会在当前用户工作目录下构造一个"/.inlong/"目录存储配置数据
+               if (StringUtils.isNotEmpty(configBasePath)) {
+            dataProxyConfig.setConfStoreBasePath(configBasePath);
+        }
+               // 设置是否允许使用本地保存的配置信息,该设置可选,缺省不启用
+        dataProxyConfig.setReadProxyIPFromLocal(isReadProxyIPFromLocal);
+               // 初始化MessageSender对象,异常将抛异常
+        messageSender = 
DefaultMessageSender.generateSenderByClusterId(dataProxyConfig);
+               // 设置 SDK 与DataProxy间消息发送的消息类型,该设置可选,缺省默认为7以二进制形式进行数据发送
+        messageSender.setMsgtype(msgType);
+    } catch (Exception e) {
+        logger.error("getMessageSender has exception e = {}", e);
+    }
+       // 返回初始化结果
+    return messageSender;
+}
+```
+
+### 调用发送接口进行数据上报
+SDK 的数据发送接口时线程安全的,支持以同步或者异步模式发送单条或多条消息。Demo里采用的是单条同步消息发送,并且消息中不包含属性信息:
+```java
+public void sendTcpMessage(DefaultMessageSender sender, String inlongGroupId, 
String inlongStreamId, String messageBody, long dt) {
+    SendResult result = null;
+    try {
+        // 以同步模式发送单条消息,不携带属性信息
+        result = sender.sendMessage(messageBody.getBytes("utf8"), 
inlongGroupId, inlongStreamId,
+                0, String.valueOf(dt), 20, TimeUnit.SECONDS);
+    } catch (UnsupportedEncodingException e) {
+        e.printStackTrace();
+    }
+    logger.info("messageSender {}", result);
+}
+```
+
+大家还可以根据业务需要选择不同的发送接口进行数据上报,具体接口细节可以参考[MessageSender](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/MessageSender.java)接口文件中的定义,里面有详细的接口使用及参数定义介绍,这里不做额外说明。
+
+### 关闭 SDK 
+Demo 里没有实现关闭操作,使用时我们需要调用MessageSender接口对象的close()函数关闭数据上报服务:
+
+# 注意事项
+- 
MessageSender接口对象是基于GroupID进行初始化,因而每个MessageSender对象基于GroupID区别使用,同一个进程内允许创建多个MessageSender对象;
+- SDK 
封装了TCP、HTTP、UDP共三种不同的网络交互方式,并在[example](https://github.com/apache/inlong/blob/master/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/example)目录里给出了3种方式的不同示例(参考TcpClientExample.java,HttpClientExample.java,UdpClientExample.java实现),业务可以根据自身需要来初始化不同的MessageSender对象;
+- SDK 中包含了复杂的网络交互,使用时需要将 SDK 
作为常驻服务对象来使用,避免同个进程中途频繁地初始化和关闭MessageSender对象(重复初始化和关闭会带来很大的资源开销,并且影响数据上报的时效性);
+- SDK 不对发送失败的消息做重发处理,用户在使用 SDK 上报数据时遇到发送失败,业务要根据自身数据要求来决定是否重发消息,避免数据丢失。
+
+## 错误码介绍
+常见result会有以下几种值
+
+| 返回值                                   | 含义                           | 备注    
                                        |
+|---------------------------------------|------------------------------|-----------------------------------------------|
+| SendResult.OK                         | 消息发送成功                       |       
                                        |
+| SendResult.TIMEOUT                    | 请求响应超时                       |       
                                        |
+| SendResult.CONNECTION_BREAK           | 链接被断开                        |       
                                        |
+| SendResult.THREAD_INTERRUPT           | 中断                           |       
                                        |
+| SendResult.ASYNC_CALLBACK_BUFFER_FULL | SDK 待回包请求消息满                 | 
这种情况一般为前端生产数据的速度超过服务端的响应速度导致,建议发送时适当sleep避免阻塞 |
+| SendResult.NO_CONNECTION              | 没有可用链接                       | 
这种情况建议业务增大可用链接数                               |
+| SendResult.INVALID_DATA               | 数据无效,通过HTTP上报数据DataProxy返回失败 |       
                                        |
+| SendResult.INVALID_ATTRIBUTES         | 发送的数据包不合理,比如为空数据包或包含了系统预定义属性 |       
                                        |
+| SendResult.UNKOWN_ERROR               | 未知错误                         |       
                                        |
+
+## ProxyClientConfig相关配置项介绍
+
+| 参数设置                                                      | 说明               
                                                                                
                 | 调整建议                                                         
                   |
+|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
+| setAliveConnections(int aliveConnections)                 | 
设置DataProxy连接数大小;默认值:3                                                          
                                  | 
1)数据量大或对时延敏感,适当增大该参数;2)根据DataProxy集群大小,适当调整该参数,比如集群规模为30,该值可设为5~10;3)现网经验值15~20 
|
+| setTotalAsyncCallbackSize(int asyncCallbackSize)          | 设置异步发送时 SDK 
内部缓冲队列大小;缓存队列用于暂存已发送但未收到服务端Ack的数据包。当缓冲数据达到该值,业务继续异步上报数据,会收到ASYNC_CALLBACK_BUFFER_FULL异常;默认值:
 50000    | 1)通常无需调整该参数;2)数据量非常大或者DataProxy服务端负载较高情况下,可适当增大,注意不要太大导致OOM         
            |
+| setConnectTimeoutMillis(long connectTimeoutMillis)        | 
设置连接超时时长,单位ms,缺省40000                                                           
                                  | 根据实际环境需要设置                                  
                                    |
+| setRequestTimeoutMillis(long requestTimeoutMillis)        | 
设置请求超时时长,单位ms,缺省40000                                                           
                                  | 根据需要调整设置                                    
                                    |
+| setMaxTimeoutCnt(int maxTimeoutCnt)                       | 
设置单个DataProxy连接超时断连次数; SDK 
内部会对超时未收到Ack的DataProxy连接进行计数,短时间内同一个连接超时数达到该值,会主动断开该连接,选择其他DataProxy创建新的连接进行数据发送。默认值:3
 | 如果DataProxy集群本身规模较小,可适当调大该参数,避免短时间频繁断连                                       
   |
+| setManagerConnectionTimeout(int managerConnectionTimeout) | 设置 SDK 
连接Manager的超时时长,单位ms,默认10000ms                                                   
                           | 1)网络环境不好的情况下可适当增大该值;2)客户端解析域名时间较长情况下可适当增大该值        
                             |
+| setManagerSocketTimeout(int managerSocketTimeout)         | 设置 SDK 
从Manager连接读取DataProxy列表的超时时间,单位ms,默认值30000                                      
                           | 网络环境不好的情况下可适当增大该值                                  
                             |
\ No newline at end of file
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/overview.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/overview.md
deleted file mode 100644
index af68ca4b4e..0000000000
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sdk/dataproxy-sdk/overview.md
+++ /dev/null
@@ -1,60 +0,0 @@
----
-title: 总览
----
-
-DataProxy 支持多种格式的数据的识别,用户既可以按照 DataProxy 可识别的格式(如六段协议、数字化协议等)自定义组装数据发送。
-也可以,采用 DataProxy 提供的 SDK 进行数据接入。
-
-DataProxy SDK 提供负载均衡、动态更新 proxy 
列表等安全特性,能够保证接入数据的可靠性,简化用户的接入逻辑,降低用户的接入难度,这里建议使用 SDK 方式接入。
-
-## 功能说明
-
-|  功能   | 详细描述  |
-|  ----  | ----  |
-| 组包功能(新)  | 将用户数据按打包发送到 DataProxy 可识别的组包格式(如六段协议、数字化协议等)打包发送到 DataProxy|
-| 压缩功能  | 发送打包发送到 DataProxy 前,将用户数据进行压缩,减少网络带宽占用 |
-| 维护 DataProxy 列表  | 每隔五分钟获取打包发送到DataProxy列表 ,以检测运维侧是否存在上下线 DataProxy 
机器的情况;每隔20s自动剔除不可用连接,以保证已连接的 DataProxy 能正常运作 |
-| 指标统计(新)  | 增加业务分钟级别发送量的指标(接口级) |
-| 负载均衡(新)  | 使用新的策略将发送的数据在多个 DataProxy 间进行负载均衡,不再依靠简单的随机+轮询机制来保证 |
-| DataProxy 列表持久化(新)  | 根据业务id对 DataProxy 列表持久化,防止程序启动时配置中心发生故障无法发送数据
-
-
-## 数据发送
-
-### 同步批量函数
-```
-    public SendResult sendMessage(List<byte[]> bodyList, String groupId, 
String streamId, long dt, long timeout, TimeUnit timeUnit)
-
-    参数说明
-
-    bodyList 是用户需要发送的多条数据的集合,总长度建议小于512k。groupId 代表业务 id,streamId 代表接口id。dt 
表示该数据的时间戳,精确到毫秒级别。也可直接设置为0,此时api会后台获取当前时间作为其时间戳。timeout & 
timeUnit:这两个参数是设置发送数据的超时时间,一般建议设置成20s。
-```
-
-
-### 同步单条函数
-```
-    public SendResult sendMessage(byte[] body, String groupId, String 
streamId, long dt, long timeout, TimeUnit timeUnit)
-
-    参数说明
-
-    body是用户要发送的单条数据内容,其余各参数涵义基本与批量发送接口一致。
-```
-
-
-### 异步批量函数
-```
-    public void asyncSendMessage(SendMessageCallback callback, List<byte[]> 
bodyList, String groupId, String streamId, long dt, long timeout,TimeUnit 
timeUnit)
-
-    参数说明
-
-    SendMessageCallback 是处理消息的 callback。bodyList 
为用户需要发送的多条数据的集合,多条数据的总长度建议小于512k。groupId 是业务 id,streamId 是接口 id。dt 
表示该数据的时间戳,精确到毫秒级别。也可直接设置为0,此时 api 会后台获取当前时间作为其时间戳。timeout 和timeUnit 
是发送数据的超时时间,一般建议设置成 20s。
-```
-
-### 异步单条函数
-```
-    public void asyncSendMessage(SendMessageCallback callback, byte[] body, 
String groupId, String streamId, long dt, long timeout, TimeUnit timeUnit)
-
-    参数说明
-
-    body 为单条消息内容,其余各参数涵义基本与批量发送接口一致
-```
\ No newline at end of file

Reply via email to