Interface INotificationHandler
An interface for all notification handlers. Implement it and pass an instance of the implementation to Handlers to be notified when a Realm changes.
Namespace: Realms.Server
Assembly: Realm.dll
Syntax
public interface INotificationHandler
Methods
| Improve this Doc View SourceHandleChangeAsync(IChangeDetails)
A method invoked by the INotifier when a Realm has changed and
ShouldHandle(String) has returned true
.
Declaration
Task HandleChangeAsync(IChangeDetails details)
Parameters
Type | Name | Description |
---|---|---|
IChangeDetails | details | An instance of IChangeDetails, containing detailed information about the changes that have occurred in the Realm. |
Returns
Type | Description |
---|---|
Task | An awaitable task that, upon completion, signifies that the changes have been processed. |
Remarks
Handlers will be invoked sequentially in the order in which they have been supplied in the Handlers.
This method will be invoked sequentially for Realms with the same path and in parallel for different Realms. This means that if the processing takes a lot of time, it will build up a queue of changes for that Realm path but will not affect notifications from other Realms.
ShouldHandle(String)
A method, invoked by the INotifier when a Realm has changed. If the handler returns
true
, HandleChangeAsync(IChangeDetails) will then be invoked with information
about the change.
Declaration
bool ShouldHandle(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path to the Realm that has changed. It will be a path relative to the root of your server. |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
This method is invoked on the INotifier's worker thread, so it should return as soon as possible to avoid adversely affecting performance.
If the handler returns false
and no other handler wants to be notified about
the Realm at this path, then this method will no longer will be called for Realms
with that path. It is recommended that you always return the same value for a path
and perform any additional handling in the HandleChangeAsync(IChangeDetails) method.