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

Class ServerStateService

Service that sends and collect state information to and from the other servers using the Event system.

Inheritance
System.Object
ServerStateService
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.Clients
Assembly: EPiServer.Events.dll
Version: 9.12.2
Syntax
[ServiceConfiguration(typeof(ServerStateService), Lifecycle = ServiceInstanceScope.Singleton)]
public class ServerStateService : IDisposable, IRegisteredObject

Constructors

ServerStateService(IEventRegistry, IEventBroker, IEventHostingEnvironment, ServiceAccessor<ITimer>)

Initializes a new instance of the ServerStateService class.

Declaration
public ServerStateService(IEventRegistry eventService, IEventBroker eventBroker, IEventHostingEnvironment hostingEnvironment, ServiceAccessor<ITimer> timerFactory)
Parameters
Type Name Description
IEventRegistry eventService

The IEventRegistry instance that should be used by this instance.

IEventBroker eventBroker

The IEventBroker instance that should be used by this instance.

IEventHostingEnvironment hostingEnvironment

The current hosting environment used by this instance.

ServiceAccessor<ITimer> timerFactory

A factory that creates the timer that should be used by the service.

Exceptions
Type Condition
System.ArgumentNullException

eventService or eventBroker

ServerStateService(IEventRegistry, IEventBroker, IHostingEnvironment)

Initializes a new instance of the ServerStateService class.

Declaration
[Obsolete("Use another constructor")]
public ServerStateService(IEventRegistry eventService, IEventBroker eventBroker, IHostingEnvironment hostingEnvironment)
Parameters
Type Name Description
IEventRegistry eventService

The IEventRegistry instance that should be used by this instance.

IEventBroker eventBroker

The IEventBroker instance that should be used by this instance.

IHostingEnvironment hostingEnvironment

The current hosting environment used by this instance.

ServerStateService(IEventRegistry, IEventBroker, IHostingEnvironment, ServiceAccessor<ITimer>)

Initializes a new instance of the ServerStateService class.

Declaration
[Obsolete("Use another constructor")]
public ServerStateService(IEventRegistry eventService, IEventBroker eventBroker, IHostingEnvironment hostingEnvironment, ServiceAccessor<ITimer> timerFactory)
Parameters
Type Name Description
IEventRegistry eventService

The IEventRegistry instance that should be used by this instance.

IEventBroker eventBroker

The IEventBroker instance that should be used by this instance.

IHostingEnvironment hostingEnvironment

The current hosting environment used by this instance.

ServiceAccessor<ITimer> timerFactory

A factory that creates the timer that should be used by the service.

Exceptions
Type Condition
System.ArgumentNullException

eventService or eventBroker

Properties

LocalState

Represents the state of the local server

Declaration
public virtual ServerState LocalState { get; }
Property Value
Type Description
ServerState

Methods

CurrentServerState()

Gets an enumerable of the current server state as known by this ServerStateService instance.

Declaration
public virtual IEnumerable<ServerState> CurrentServerState()
Returns
Type Description
System.Collections.Generic.IEnumerable<ServerState>

An enumerable of ServerState instances for all server that has sent events to the current instance.

Dispose()

Declaration
public void Dispose()

Initialize()

Initializes this ServerStateService instance and broadcasts a startup state message.

Declaration
public void Initialize()

RequestState()

Sends a state request to all currently participating servers.

Declaration
public virtual void RequestState()

Uninitialize()

Uninitializes this ServerStateService instance and broadcasts a shutdown state message.

Declaration
public void Uninitialize()

Events

StateMessageReceived

Occurs when a state message is received.

Declaration
public event EventHandler<StateMessageEventArgs> StateMessageReceived
Event Type
Type Description
System.EventHandler<StateMessageEventArgs>

Implements

System.IDisposable
System.Web.Hosting.IRegisteredObject

Extension Methods