Skip to content

Commit ac338bd

Browse files
authored
Update README.zh-cn.md (#1703)
1 parent 7261824 commit ac338bd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.zh-cn.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,21 @@ public void ConfigureServices(IServiceCollection services)
209209
}
210210
```
211211

212+
#### 异步订阅
213+
214+
你能够实现异步订阅。订阅方法应返回 `Task` 并接收 `CancellationToken` 作为参数。
215+
216+
```c#
217+
public class AsyncSubscriber : ICapSubscribe
218+
{
219+
[CapSubscribe("name")]
220+
public async Task ProcessAsync(Message message, CancellationToken cancellationToken)
221+
{
222+
await SomeOperationAsync(message, cancellationToken);
223+
}
224+
}
225+
```
226+
212227
#### 使用多部分订阅名
213228

214229
要在类级别对订阅的Topic进行分组,您可以将在方法上的订阅设置为部分订阅。 消息队列上的订阅将是类上定义的topic加上方法上定义的topic的拼合。

0 commit comments

Comments
 (0)