Class FromEnd
Corresponds to a relative offset that begins the query at the Count-th event from the end of history (inclusive), e.g. "give me the last 10 events" for a tag or across all events.
Unlike Sequence and TimeBasedUuid, FromEnd is a query input only: it is never returned in an EventEnvelope. Each EventEnvelope still carries a concrete Sequence offset, so to resume a stream at a later point you use that absolute offset, not a FromEnd value. Because it is relative rather than absolute, FromEnd is not orderable and CompareTo(Offset) always throws.
The from-the-end position is resolved to a concrete start offset when the query is materialized, by reading how many matching events exist at that moment. For a live query (or any backend that resolves the count and reads the events in separate steps) this is best-effort: events written between resolving the count and reading the first batch may widen the initial window beyond Count.
Not all read journals support this offset type. Implementations that cannot honor it will throw when it is supplied, the same way they reject any other unsupported offset type.
Implements
Inherited Members
Namespace: Akka.Persistence.Query
Assembly: Akka.Persistence.Query.dll
Syntax
public sealed class FromEnd : Offset, IComparable<Offset>
Constructors
| Edit this page View SourceFromEnd(int)
Initializes a new instance of the FromEnd class.
Declaration
public FromEnd(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | The number of events to read from the end of history. Must be greater than zero. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
Properties
| Edit this page View SourceCount
The number of events to read from the end of history.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceCompareTo(Offset)
FromEnd is a relative, input-only offset and has no position in the stream, so it cannot be ordered against any offset (including another FromEnd). Always throws.
Declaration
public override int CompareTo(Offset other)
Parameters
| Type | Name | Description |
|---|---|---|
| Offset | other |
Returns
| Type | Description |
|---|---|
| int |
Overrides
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Always thrown. |
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
| Edit this page View SourceGetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
| Edit this page View SourceToString()
Used to log offset's value
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Edit this page