SubscriptionReplayTracker

StockSharp.Messages

Tracks active subscriptions for connectors that handle reconnection internally. After reconnection, provides cloned subscriptions with From = null (online-only, no history re-request).

Properties

Count
public int Count { get; }
value = subscriptionReplayTracker.Count

Number of currently tracked subscriptions.

Methods

Clear
public void Clear()
subscriptionReplayTracker.Clear()

Clear all tracked subscriptions. Call on full reset/disconnect.

GetSubscriptionsForReplay
public IEnumerable<ISubscriptionMessage> GetSubscriptionsForReplay()
result = subscriptionReplayTracker.GetSubscriptionsForReplay()

Get all active subscriptions for replay after an internal reconnect. Returns clones with From = null under the original transaction IDs so the reconnect stays transparent to code above the adapter — external subscribers keep receiving data under the txId they originally subscribed with.

Returns: Cloned subscription messages ready to be re-sent.

Process
public void Process(ISubscriptionMessage message)
subscriptionReplayTracker.Process(message)

Track or untrack a subscription based on IsSubscribe.

message
Subscription message.
Track
public void Track(ISubscriptionMessage message)
subscriptionReplayTracker.Track(message)

Track a subscription. Call when the adapter receives a subscribe message.

message
Subscription message (IsSubscribe must be true).
Untrack
public bool Untrack(long originalTransactionId)
result = subscriptionReplayTracker.Untrack(originalTransactionId)

Stop tracking a subscription. Call when the adapter receives an unsubscribe message.

originalTransactionId
Original transaction ID of the subscription to remove.

Returns: if the subscription was found and removed.