Skip to content

Commit

Permalink
[ISSUE #200] Add File connector docs (#201)
Browse files Browse the repository at this point in the history
* add fileConnector

* add a Eng version
  • Loading branch information
Ish1yu authored Mar 11, 2024
1 parent 36cb6e8 commit 8182f9b
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/design-document/03-connect/10-file-connector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# File

## FileSinkConnector:Writes File file from EventMesh

1. Start your EventMesh Runtime.
2. Enable sinkConnector and check `sink-config.yml`.
3. Started FileConnectServer,It will subscribe to the topic defined in `pubSubConfig.subject` in the EventMesh Runtime,And write the data to the path located : `connectorConfig.topic`/Year/Month/Day ; the file named:【 `connectorConfig.topic` + Current time Hour (24 hours) + timestamp 】.
4. Using the Topic specified in `pubSubConfig.subject`, send a message to EventMesh, which you will persist in the file.

```yaml
# public config
pubSubConfig:
meshAddress: 127.0.0.1:10000
subject: TopicTest
idc: FT
env: PRD
group: fileSink
appId: 5031
userName: fileSinkUser
passWord: filePassWord
connectorConfig:
connectorName: fileSink
#topic Generally, the configuration is the same as that of pubSubConfig.subject. The generated file name contains the configuration value of this property
topic: TopicTest
```
## FileSourceConnector:Read from File to EventMesh
1. Start your EventMesh Runtime.
2. Enable sinkConnector and check `source-config.yml`.
3. Started FileConnectServer,It sends the data read from `connectorConfig.filePath` to `pubSubConfig.subject` in the EventMesh Runtime.
4. The append to the file content is recognized, and you receive the message in EventMesh

```yaml
# public config
pubSubConfig:
meshAddress: 127.0.0.1:10000
subject: TopicTest
idc: FT
env: PRD
group: fileSource
appId: 5032
userName: fileSourceUser
passWord: filePassWord
connectorConfig:
connectorName: fileSource
# Source file address
filePath: userFilePath
```

> Special note: System.in and System.out are used if the source file or import file cannot be retrieved
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# File

## FileSinkConnector:从 EventMesh 写入文件 File

1. 启动你的 EventMesh Runtime。
2. 启用 sinkConnector 并检查 `sink-config.yml`
3. 启动你的 FileConnectServer,它将订阅到 EventMesh Runtime 中 `pubSubConfig.subject` 中定义的主题,并将数据写入到 路径位于: `connectorConfig.topic`/年/月/日 ;名为: 【 `connectorConfig.topic` + 当前时间小时位(24小时制) + 时间戳 】的文件
4. 使用在 `pubSubConfig.subject` 中指定的 Topic,向 EventMesh 发送消息,然后你将在 文件 中持久化该消息。

```yaml
# 公共配置
pubSubConfig:
meshAddress: 127.0.0.1:10000
subject: TopicTest
idc: FT
env: PRD
group: fileSink
appId: 5031
userName: fileSinkUser
passWord: filePassWord
connectorConfig:
connectorName: fileSink
#主题 一般和pubSubConfig.subject配置成一样的,生成文件的文件名中含有此属性配置值
topic: TopicTest
```
## FileSourceConnector:从 File 文件读取 到 EventMesh
1. 启动你的 EventMesh Runtime。
2. 启用 sourceConnector 并检查 `source-config.yml`。
3. 启动你的 FileConnectServer,它将从 `connectorConfig.filePath `中读取的数据发送到 EventMesh Runtime 中的 `pubSubConfig.subject`。
4. 文件内容的 追加操作 会被识别,然后你将在 EventMesh 中接收到该消息

```yaml
# 公共配置
pubSubConfig:
meshAddress: 127.0.0.1:10000
subject: TopicTest
idc: FT
env: PRD
group: fileSource
appId: 5032
userName: fileSourceUser
passWord: filePassWord
connectorConfig:
connectorName: fileSource
# 源文件地址
filePath: userFilePath
```

> 特殊说明:如果没能获取源文件或汇入文件,则使用 System.in 和 System.out

0 comments on commit 8182f9b

Please sign in to comment.