Class SubscriptionKeys
- Namespace
- Excalibur.EventSourcing.Subscriptions
- Assembly
- Excalibur.EventSourcing.dll
Composes the durable keys a subscription uses. The single source of truth for those strings.
public static class SubscriptionKeys
- Inheritance
-
SubscriptionKeys
- Inherited Members
Remarks
Shared rather than private because more than one party must derive the SAME strings, and a second copy of either expression is a silent failure waiting to happen.
Methods
CheckpointName(string, string)
One projection's in-process identity within a subscription.
public static string CheckpointName(string subscriptionName, string projectionKey)
Parameters
subscriptionNamestringThe stable subscription name.
projectionKeystringThe projection's key, as carried by SubscriptionMember.
Returns
- string
A single string naming that projection's cursor, for in-process bookkeeping.
Remarks
THIS IS NOT A STORAGE KEY, and it must never become one again. A durable cursor is addressed by the PAIR -- the subscription name and the projection key, in their own columns, bounded at 255 and 512 -- because the composition reaches 768 while any one column wide enough for the name alone is too narrow for both. A deeply namespaced projection type reaches that, and the member row binds successfully (its own columns are 255 and 512, and both inputs are individually legal), so the result is a bound member whose cursor can never be written: a permanent stall, not a refusal. On a provider configured to truncate rather than refuse, it is worse -- two projections share one cursor and each skips what the other consumed.
What it is still for: keying the in-process progress map a single host keeps, where one string per projection is the natural dictionary key and no column bounds it. Both parts are compared ordinally there, as they are in storage.
DefinitionFingerprint(string, string, string, string, string)
Computes one member's definition fingerprint. The single source of truth for that computation.
public static string DefinitionFingerprint(string subscriptionScope, string subscriptionRevision, string assemblyName, string projectionKey, string destination)
Parameters
subscriptionScopestringThe subscription's logical source and destination scope.
subscriptionRevisionstringThe consumer's semantic revision.
assemblyNamestringThe projection type's assembly name.
projectionKeystringThe projection type's identity, as carried by a member.
destinationstringThe resolved destination identity, or empty when none is advertised.
Returns
- string
An uppercase 64-character hexadecimal SHA-256 fingerprint.
Remarks
SHARED BECAUSE MORE THAN ONE HOST COMPUTES IT, and a second copy would be worse than a second copy of a key. Two hosts that encode the same definition differently produce different fingerprints for identical configuration, so each refuses the other's binding permanently, and the refusal names a projection whose definition a reader can see is the same. A drifting key makes a cursor unreachable; a drifting fingerprint makes the subscription unstartable.
Each part is LENGTH-PREFIXED rather than delimited, which is what keeps the encoding unambiguous when a part contains the separator. Without it, two different definitions whose parts concatenate to the same string would collide and silently share a binding.
ProjectionKey(Type)
Gets the durable member key for a projection's declared generation.
public static string ProjectionKey(Type projectionType)
Parameters
projectionTypeTypeThe read-model type.
Returns
- string
The type identity qualified by its declared generation.
ProjectionKey(Type, int)
Gets a member key for an explicitly selected generation, including a previous generation.
public static string ProjectionKey(Type projectionType, int version)
Parameters
projectionTypeTypeThe read-model type whose identity is used.
versionintThe generation, starting at one.
Returns
- string
The durable member key.