Drops snapshot-type websocket messages that arrive for the same key more often than Period. The first message for a key and every message received after the period has elapsed pass through, so the consumer always sees a fresh full snapshot and nothing is lost for channels where every message carries the complete state (exchange tickers pushed by a timer). Must not be used for delta channels (order book updates, delta tickers), where every message matters.
More...
|
| delegate bool | KeySelector (ReadOnlySpan< byte > message, out ReadOnlySpan< byte > key) |
| | Extracts the throttling key (usually the instrument id) from a raw message. Returns false for messages that must never be throttled.
|
| |
| | SnapshotMessageThrottle (KeySelector keySelector, Func< TimeSpan > periodProvider, TimeProvider? timeProvider=null) |
| |
| bool | Accept (ReadOnlyMemory< byte > message) |
| | Returns true if the message should be processed, false if it is a redundant snapshot.
|
| |
Drops snapshot-type websocket messages that arrive for the same key more often than Period. The first message for a key and every message received after the period has elapsed pass through, so the consumer always sees a fresh full snapshot and nothing is lost for channels where every message carries the complete state (exchange tickers pushed by a timer). Must not be used for delta channels (order book updates, delta tickers), where every message matters.
Not thread-safe by design: one instance serves one websocket whose read loop delivers messages sequentially.
◆ SnapshotMessageThrottle()
| ATAS.DataFeedsCore.ConnectorWebsocket.SnapshotMessageThrottle.SnapshotMessageThrottle |
( |
KeySelector |
keySelector, |
|
|
Func< TimeSpan > |
periodProvider, |
|
|
TimeProvider? |
timeProvider = null |
|
) |
| |
- Parameters
-
| keySelector | Extracts the key from a raw message; messages without a key always pass. |
| periodProvider | Read on every message so the period can come from connector settings that are applied after the socket is created. |
| timeProvider | Clock override for tests. |
◆ Accept()
| bool ATAS.DataFeedsCore.ConnectorWebsocket.SnapshotMessageThrottle.Accept |
( |
ReadOnlyMemory< byte > |
message | ) |
|
Returns true if the message should be processed, false if it is a redundant snapshot.
◆ KeySelector()
| delegate bool ATAS.DataFeedsCore.ConnectorWebsocket.SnapshotMessageThrottle.KeySelector |
( |
ReadOnlySpan< byte > |
message, |
|
|
out ReadOnlySpan< byte > |
key |
|
) |
| |
Extracts the throttling key (usually the instrument id) from a raw message. Returns false for messages that must never be throttled.
◆ Accepted
| long ATAS.DataFeedsCore.ConnectorWebsocket.SnapshotMessageThrottle.Accepted |
|
get |
◆ Dropped
| long ATAS.DataFeedsCore.ConnectorWebsocket.SnapshotMessageThrottle.Dropped |
|
get |
◆ Period
| TimeSpan ATAS.DataFeedsCore.ConnectorWebsocket.SnapshotMessageThrottle.Period |
|
get |
Current period. TimeSpan.Zero or negative disables throttling.
The documentation for this class was generated from the following file:
- SnapshotMessageThrottle.cs