Skip to content

Commit 9cb6596

Browse files
Update README.md with Cancel methods.
1 parent fe41a25 commit 9cb6596

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,17 @@ return _hub.CreateAsync (topic, configuration, worker);
7171
public Task ProduceMessage (string id, string operation, int value) =>
7272
_hub.Publish (topic, new MyMessage (di, operation, value));
7373
```
74+
75+
4. Cancel and wait for events to be completed
76+
77+
Becasue the entire library puspose of the library is to be able to process
78+
events in a multithreaded manner, the main thread has to wait until the events
79+
are processed. That can be done by waiting on a Channel to be closed:
80+
81+
```csharp
82+
// close a specific topic
83+
await _hub.CloseAsync<WorkQueuesEvent> (topic);
84+
85+
// close all topcis
86+
await _hub.CloseAsync<WorkQueuesEvent> (topic1);
87+
```

0 commit comments

Comments
 (0)