You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add the new WithOnSubscriptionHook for the Receive method (#846)
* feat: add the new WithOnSubscriptionHook for the Receive method
Signed-off-by: Rueian <[email protected]>
* feat: apply betteraligment
Signed-off-by: Rueian <[email protected]>
* feat: add the new WithOnSubscriptionHook for the Receive method
Signed-off-by: Rueian <[email protected]>
* feat: add the new WithOnSubscriptionHook for the Receive method
Signed-off-by: Rueian <[email protected]>
---------
Signed-off-by: Rueian <[email protected]>
// Handle the message. Note that if you want to call another `client.Do()` here, you need to do it in another goroutine or the `client` will be blocked.
280
+
// Handle the message. If you need to perform heavy processing or issue
281
+
// additional commands, do that in a separate goroutine to avoid
282
+
// blocking the pipeline, e.g.:
283
+
// go func() {
284
+
// // long work or client.Do(...)
285
+
// }()
281
286
})
282
287
```
283
288
@@ -294,6 +299,28 @@ While the `client.Receive()` call is blocking, the `Client` is still able to acc
294
299
and they are sharing the same TCP connection. If your message handler may take some time to complete, it is recommended
295
300
to use the `client.Receive()` inside a `client.Dedicated()` for not blocking other concurrent requests.
296
301
302
+
#### Subscription confirmations
303
+
304
+
Use `rueidis.WithOnSubscriptionHook` when you need to observe subscribe / unsubscribe confirmations that the server sends during the lifetime of a `client.Receive()`.
305
+
306
+
The hook can be triggered multiple times because the `client.Receive()` may automatically reconnect and resubscribe.
0 commit comments