Does anybody know the correct way to handle calls to async methods inside a notification handler? I know there are quite a few ways to call async methods from sync code but it seems to depend on the context, and I just don't want to inadvertedly cause any locks.
Or maybe I'm just missing something really obvious.
This question is a year old but just for anyone coming here looking for an answer, there is a version of the INotificationHandler for async operations. For example
public class MemberNotificationHandler :
INotificationAsyncHandler<MemberSavedNotification>
{
public async Task HandleAsync(MemberSavedNotification notification, CancellationToken cancellationToken)
{
...
}
}
I have a handler that implements INotificationAsyncHandler.
When I set a breakpoint in the HandlerAsync method, it never hits. Could it be that this Task returning method is run synchronously ?
Async notification handlers
Hi guys,
Does anybody know the correct way to handle calls to async methods inside a notification handler? I know there are quite a few ways to call async methods from sync code but it seems to depend on the context, and I just don't want to inadvertedly cause any locks.
Or maybe I'm just missing something really obvious.
Any help is greatly appreciated!
This question is a year old but just for anyone coming here looking for an answer, there is a version of the INotificationHandler for async operations. For example
public class MemberNotificationHandler : INotificationAsyncHandler<MemberSavedNotification> { public async Task HandleAsync(MemberSavedNotification notification, CancellationToken cancellationToken) { ... } }
https://apidocs.umbraco.com/v12/csharp/api/Umbraco.Cms.Core.Events.INotificationAsyncHandler-1.html
I have a handler that implements INotificationAsyncHandler. When I set a breakpoint in the HandlerAsync method, it never hits. Could it be that this Task returning method is run synchronously ?
is working on a reply...