Class RegexNotificationHandler
A INotificationHandler implementation that handles Realm changes based on a Regex.
Implements
Namespace: Realms.Server
Assembly: Realm.dll
Syntax
public abstract class RegexNotificationHandler : INotificationHandler
Constructors
| Improve this Doc View SourceRegexNotificationHandler(String)
Initializes a new instance of the RegexNotificationHandler class.
Declaration
protected RegexNotificationHandler(string regex)
Parameters
Type | Name | Description |
---|---|---|
String | regex | A regular expression that will be used to match Realm paths against. |
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
public abstract 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
public 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
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.