Skip to content

Commit 41e39cc

Browse files
authored
docs: fix ack error doc (#3869)
Signed-off-by: Song Gao <disxiaofei@163.com>
1 parent 49a1987 commit 41e39cc

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

docs/en_US/extension/portable/python_sdk.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ When `requireAck` is enabled, the user's custom sink plugin **must** return an a
8383
}
8484
```
8585

86-
Sink implementation must call `ctx.ack_ok()` or `ctx.ack_err(msg)` to return acknowledge. In the following example , the
86+
Sink implementation must call `ctx.ack_ok()` or `ctx.ack_error(msg)` to return acknowledge. In the following example , the
8787
collect function inside sink returns ack after handling the data.
8888

8989
```python
@@ -93,6 +93,13 @@ def collect(self, ctx: Context, data: Any):
9393
ctx.ack_ok()
9494
```
9595

96+
```python
97+
def collect(self, ctx: Context, data: Any):
98+
print('receive: ', data)
99+
# only add ack when using with requireAck in the rule
100+
ctx.ack_error('error msg')
101+
```
102+
96103
Function interface:
97104

98105
```python

docs/zh_CN/extension/portable/python_sdk.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ sink 时可以配置是否等待 ack 再发送下一条数据。例如,假设
8282
}
8383
```
8484

85-
Sink 插件中调用 `ctx.ack_ok()``ctx.ack_err(msg)` 返回 ack 信息。以下为示例 collect 函数,调用成功时返回 ack 。
85+
Sink 插件中调用 `ctx.ack_ok()``ctx.ack_error(msg)` 返回 ack 信息。以下为示例 collect 函数,调用成功时返回 ack 。
8686

8787
```python
8888
def collect(self, ctx: Context, data: Any):
@@ -91,6 +91,13 @@ def collect(self, ctx: Context, data: Any):
9191
ctx.ack_ok()
9292
```
9393

94+
```python
95+
def collect(self, ctx: Context, data: Any):
96+
print('receive: ', data)
97+
# only add ack when using with requireAck in the rule
98+
ctx.ack_error('error msg')
99+
```
100+
94101
函数接口:
95102

96103
```python

0 commit comments

Comments
 (0)