---
title: Create a custom event provider
slug: cms-13/docs/create-a-custom-event-provider
docTags: 
createdAt: 2026-07-30T20:22:11.023Z
---

Create a custom event provider when you need a transport mechanism other than the built-in or Azure options. Extend the `EventProvider` base class from `EPiServer.Events.Providers`, implement the required methods, and register the provider in the service container at startup. Prebuilt providers for Amazon and Azure are available on the [Optimizely NuGet](http://nuget.episerver.com) feed.

The following example defines a custom event provider with a configurable options class:

```csharp
using EPiServer.Events;
using EPiServer.Events.Providers;
using Microsoft.Extensions.Options;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace CustomEventProvider;

public class CustomEventProviderOptions 
{
    public string CustomSetting { get; set; } = "custom setting";
}

public class CustomEventProvider : EventProvider 
{
    public CustomEventProvider(IOptions<CustomEventProviderOptions> options) {}

    public override Task InitializeAsync() 
    {
        // Initialize the provider and call OnMessageReceived(messages) when messages arrive
    }

    public override Task SendMessageAsync(EventMessage message, CancellationToken cancellationToken) 
    {
        // Send the message to other instances
    }
  
    public override void SendMessage(EventMessage message) 
    {
        throw new NotSupportedException("Use SendMessageAsync instead.");
    }
}
```

## Register the custom event provider

Register the custom event provider in `Startup.cs` and configure its options. The following example replaces the default provider with `MyEventProvider`:

```csharp
public void ConfigureServices(IServiceCollection services)
{
    services.AddCmsEvents();
    services.AddSingleton<EventProvider, MyEventProvider>();
    services.Configure<CustomEventProviderOptions>(o => o.CustomSetting = "some value");
}
```
