Class ServerStateService
Service that sends and collect state information to and from the other servers using the Event system.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Events.Clients
Assembly: EPiServer.Events.dll
Version: 8.11.0Syntax
public class ServerStateService : IDisposable, IRegisteredObject
Constructors
ServerStateService(IEventRegistry, IEventBroker, IHostingEnvironment)
Initializes a new instance of the ServerStateService class.
Declaration
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
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> |