EventListenerExtension reference
This article provides reference material about EventListenerExtension<TEvent>
class. The EventListenerExtension<TEvent>
class serves as the base class for creating event listener extensions in the Sana framework.
This class is abstract and generic, meaning it must be inherited and specified with a concrete event type derived from ExtensionEvent
Methods
HandleAsync
Handles the event payload.
public class SubscribedToNewsletterListenerExtension : EventListenerExtension<SubscribedToNewsletterEvent>
{
public override Task HandleAsync(SubscribedToNewsletterEvent payload, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
Api.Log($"The user with email '{payload.Email}' has subscribed to newsletters.");
return Task.CompletedTask;
}
}