-
Notifications
You must be signed in to change notification settings - Fork 8
Hook Operator Customization
Furkan Güngör edited this page Dec 22, 2021
·
2 revisions
IronHook supports the HttpHookOperator structure by default.
This build can be overridden for custom needs.
For Example; You may want to log while your hook operations are running.
Let's customize.
public class CustomizeHookOperator : HttpHookOperator
{
private readonly ILogger<CustomizeHookOperator> logger;
public CustomizeHookOperator(IIronHookContext ironHookContext, ILogger<CustomizeHookOperator> logger) : base(ironHookContext)
{
this.logger = logger;
}
public override Task<IList<HookResponse>> SendHookAsync<T>(Hook hook, List<HookRequest> requests, T data = default)
{
logger.LogInformation("Starting Hook");
return base.SendHookAsync(hook, requests, data);
}
}
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddIronHook(options =>
{
options.UseNpgsql(Configuration.GetConnectionString("Default"), opts => opts.UseIronHookNpgsqlMigrations());
});
services.AddTransient<IHookOperator, CustomizeHookOperator>();
}
Welcome to the Iron Hook wiki!
Topics:
-
Getting Started
-
Providers
-
Quick Implementation
-
Customization
-
Other