Class EventProvider
Base class for providers that is used for communication between sites.
Inherited Members
Namespace: EPiServer.Events.Providers
Assembly: EPiServer.Events.dll
Version: 11.20.7Syntax
public abstract class EventProvider
Constructors
EventProvider()
Declaration
protected EventProvider()
Properties
Name
Gets the name of the event provider instance
Declaration
public virtual string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ValidateMessageIntegrity
Gets a value indicating if messages received from the provider should be checked for their integrity.
Declaration
public virtual bool ValidateMessageIntegrity { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
Initialize(String, NameValueCollection)
Initializes the provider.
Declaration
public virtual void Initialize(string name, NameValueCollection config)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The friendly name of the provider |
System.Collections.Specialized.NameValueCollection | config | A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider. |
InitializeAsync()
Override this method if the provider has some time consuming initialization that can be done in parallel with other initalization modules.
Declaration
public virtual Task InitializeAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
This method will be called from Initialize(InitializationEngine) and then in InitComplete it will wait for the ongoing task to complete.
OnMessageReceived(EventMessageEventArgs)
Raises the MessageReceived event.
Declaration
protected virtual void OnMessageReceived(EventMessageEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
EventMessageEventArgs | args | The EventMessageEventArgs instance containing the event data. |
Remarks
Any exceptions thrown by an event listener will be suppressed by this method, use another overload to control behaviour of exceptions from the provider
OnMessageReceived(EventMessageEventArgs, Boolean)
Raises the MessageReceived event.
Declaration
protected virtual void OnMessageReceived(EventMessageEventArgs args, bool suppressExceptions)
Parameters
Type | Name | Description |
---|---|---|
EventMessageEventArgs | args | The EventMessageEventArgs instance containing the event data. |
System.Boolean | suppressExceptions |
|
SendMessage(EventMessage)
Sends the provided message to other related sites.
Declaration
public abstract void SendMessage(EventMessage message)
Parameters
Type | Name | Description |
---|---|---|
EventMessage | message | The message to send. |
SendMessageAsync(EventMessage, CancellationToken)
Sends the provided message to other related sites in an asynchronous process.
Declaration
public virtual Task SendMessageAsync(EventMessage message, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
EventMessage | message | The message to send. |
System.Threading.CancellationToken | cancellationToken | A cancellation token that should be used to cancel sending the message. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
This method will call SendMessage(EventMessage) synchronously unless provider specific asynchronous processing has been implementated. It is recommended that all custom providers implement this method.
Uninitialize()
Resets the provider into an uninitialized state. Called during the uninitailization phase of the InitializationEngine.
Declaration
public virtual void Uninitialize()
Events
MessageReceived
Occurs when a remote message has been received.
Declaration
public virtual event EventHandler<EventMessageEventArgs> MessageReceived
Event Type
Type | Description |
---|---|
System.EventHandler<EventMessageEventArgs> |