Class LeaderChangedEventArgs
- Namespace
- Excalibur.Dispatch.LeaderElection
- Assembly
- Excalibur.Dispatch.LeaderElection.Abstractions.dll
Event arguments for leader change events.
public sealed class LeaderChangedEventArgs : EventArgs
- Inheritance
-
LeaderChangedEventArgs
- Inherited Members
- Extension Methods
Constructors
LeaderChangedEventArgs(string?, string?, string, long?, DateTimeOffset?)
Event arguments for leader change events.
public LeaderChangedEventArgs(string? previousLeaderId, string? newLeaderId, string resourceName, long? fencingToken = null, DateTimeOffset? timestamp = null)
Parameters
previousLeaderIdstringThe identifier of the previous leader, or null if there was no previous leader.
newLeaderIdstringThe identifier of the new leader, or null if leadership was relinquished.
resourceNamestringThe name of the resource for which leadership changed.
fencingTokenlong?The fencing token minted for this leadership acquisition, or null when this node did not acquire leadership (relinquish) or no fencing token provider is configured.
timestampDateTimeOffset?When the change occurred, supplied by the caller from its configured time source. Omit it to read the system clock. An election that was given a TimeProvider passes that provider's time, so a caller controlling the clock sees the same instant here as on the election's own properties.
Properties
FencingToken
Gets the fencing token minted for this leadership acquisition, carried on the event so subscribers capture the exact token issued at this transition instead of re-reading it afterwards (which would be a time-of-check/time-of-use race under rapid re-election).
public long? FencingToken { get; }
Property Value
- long?
The fencing token, or null when leadership was relinquished or no fencing provider is configured.
NewLeaderId
Gets the new leader ID.
public string? NewLeaderId { get; }
Property Value
- string
the new leader ID.
PreviousLeaderId
Gets the previous leader ID.
public string? PreviousLeaderId { get; }
Property Value
- string
the previous leader ID.
ResourceName
Gets the resource name.
public string ResourceName { get; }
Property Value
- string
the resource name.
Timestamp
Gets when the change occurred.
public DateTimeOffset Timestamp { get; }
Property Value
- DateTimeOffset
when the change occurred.