November Happy Hour will be moved to Thursday December 5th.

Class EventProviderService

Repository that holds all configured EventProvider instances.

Inheritance
System.Object
EventProviderService
Implements
System.IDisposable
System.Web.Hosting.IRegisteredObject
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Events.Providers
Assembly: EPiServer.Events.dll
Version: 9.12.2
Syntax
public class EventProviderService : IEventProviderAccessor, IEventBroker, IDisposable, IRegisteredObject

Constructors

EventProviderService(EventProvider, IEnumerable<EventProvider>, IEventMessageFactory, IEventMessageValidator, TaskScheduler)

Initialize a new instance of EventProviderService

Declaration
public EventProviderService(EventProvider defaultProvider, IEnumerable<EventProvider> providers, IEventMessageFactory messageFactory, IEventMessageValidator messageValidator, TaskScheduler messageSendScheduler)
Parameters
Type Name Description
EventProvider defaultProvider

The default provider

System.Collections.Generic.IEnumerable<EventProvider> providers

The list of supported providers

IEventMessageFactory messageFactory

The factory used to create message instances to send.

IEventMessageValidator messageValidator

The validator that evaluates incoming messages.

System.Threading.Tasks.TaskScheduler messageSendScheduler

The task scheduler used to send messages.

Properties

DefaultProvider

Gets the default provider.

Declaration
public EventProvider DefaultProvider { get; }
Property Value
Type Description
EventProvider

Enabled

Gets or sets a value indicating whether this instance is enabled or not. If no providers are configured this will always return false.

Declaration
public bool Enabled { get; set; }
Property Value
Type Description
System.Boolean

true if this instace is enabled otherwise, false.

Instance

The singleton instance of EventProviderService (redirects to ServiceLocator.Current)

Declaration
public static EventProviderService Instance { get; }
Property Value
Type Description
EventProviderService

IsActive

Gets a value indicating if the Service will be able to send or recieve any events.

Declaration
public virtual bool IsActive { get; }
Property Value
Type Description
System.Boolean

Providers

Gets all registered providers.

Declaration
public IEnumerable<EventProvider> Providers { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<EventProvider>

The providers.

Methods

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

GetProvider(String)

Get the event provider registered with name

Declaration
public virtual EventProvider GetProvider(string providerName)
Parameters
Type Name Description
System.String providerName

The name.

Returns
Type Description
EventProvider

A event provider

Exceptions
Type Condition
System.ArgumentException

name

System.ArgumentException

Throw if no matching provider was found

Initialize()

Initializes this instance.

Declaration
public virtual void Initialize()

InitializeProvidersAsync()

Starts the optional asyncronous initialization of all registered providers.

Declaration
public virtual Task[] InitializeProvidersAsync()
Returns
Type Description
System.Threading.Tasks.Task[]

An array of Task objects that can be used to syncronize the execution again.

OnEventMissed(EventMissedEventArgs)

Called when the EventProviderService has identified a message as missing and raises the EventMissed event.

Declaration
protected virtual void OnEventMissed(EventMissedEventArgs e)
Parameters
Type Name Description
EventMissedEventArgs e

The EventMissedEventArgs instance containing the event data.

OnEventReceived(Object, EventReceivedEventArgs)

Called when any EventProvider has recieved a message and raises the EventReceived event.

Declaration
protected virtual void OnEventReceived(object sender, EventReceivedEventArgs e)
Parameters
Type Name Description
System.Object sender

The provider that received the event message.

EventReceivedEventArgs e

The EventReceivedEventArgs instance containing the event data.

RaiseEventAsync(Guid, Object)

Raises an event remotely in an asyncrounous manner.

Declaration
public virtual Task RaiseEventAsync(Guid eventId, object parameter)
Parameters
Type Name Description
System.Guid eventId

The event id of the event to raise.

System.Object parameter

The event parameter to send with the event.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task representing the work required to raise the event.

Stop(Boolean)

Requests a registered object to unregister.

Declaration
public void Stop(bool immediate)
Parameters
Type Name Description
System.Boolean immediate

true to indicate the registered object should unregister from the hosting environment before returning; otherwise, false.

Exceptions
Type Condition
System.NotImplementedException

Uninitialize()

Detaches all event handlers to provider.

Declaration
public virtual void Uninitialize()

Events

EventMissed

Occurs when it is discovered that a remote event was missed.

Declaration
public event EventHandler<EventMissedEventArgs> EventMissed
Event Type
Type Description
System.EventHandler<EventMissedEventArgs>

EventReceived

Occurs when a remote event has been received and verified.

Declaration
public event EventHandler<EventReceivedEventArgs> EventReceived
Event Type
Type Description
System.EventHandler<EventReceivedEventArgs>

Explicit Interface Implementations

IEventProviderAccessor.Provider

Gets the currently configured EventProvider.

Declaration
EventProvider IEventProviderAccessor.Provider { get; }
Returns
Type Description
EventProvider

Implements

System.IDisposable
System.Web.Hosting.IRegisteredObject

Extension Methods