Interface IMessageQueue<TMessage>
- Namespace
- ATAS.DataFeedsCore
- Assembly
- ATAS.DataFeedsCore.dll
The queue that serializes the processing of a connector: the messages and actions put into it are processed one by one by the connector's thread, and the messages are passed to the handler registered by Start(IDataFeedConnector, Action<TMessage>). BaseConnector<TMessage, TPortfolioKey, TSecurityKey, TSecurityPositionManager> starts the queue when it connects and stops it when it ends up disconnected.
public interface IMessageQueue<TMessage> : ILoggerSource
Type Parameters
TMessageThe type of the connector's messages.
- Inherited Members
- Extension Methods
Properties
HeartbeatTimeout
Interval of the Heartbeat event; System.TimeSpan.Zero disables it. The connector sets it before it starts the queue.
TimeSpan HeartbeatTimeout { get; set; }
Property Value
- TimeSpan
Methods
Enqueue(IDataFeedConnector, Action)
Queues an action to run on the connector's thread.
void Enqueue(IDataFeedConnector connector, Action action)
Parameters
connectorIDataFeedConnectorThe connector the action belongs to.
actionActionThe action.
Enqueue(IDataFeedConnector, TMessage)
Queues a message of the connector for its handler.
void Enqueue(IDataFeedConnector connector, TMessage message)
Parameters
connectorIDataFeedConnectorThe connector the message belongs to.
messageTMessageThe message.
EnqueueContinuation(IDataFeedConnector, Action)
Queues an await continuation of the connector's thread (the connector's synchronization context).
A continuation belongs to the connection session it was posted in: once that session has ended (the connector's
final disconnect stopped the queue), it must not run in a later one - it would resume the code of an abandoned
connect attempt or of a closed connection inside the new connection (complete the new attempt, start transports,
process stale data). Unlike a message queued while the connector is disconnected, which waits for the next
connect, a continuation posted after its session ended is dropped.
The default implementation queues it as an ordinary action.
Not in ATAS 8.0.15 yet: available from the next version.
void EnqueueContinuation(IDataFeedConnector connector, Action continuation)
Parameters
connectorIDataFeedConnectorcontinuationAction
Start(IDataFeedConnector, Action<TMessage>)
Starts processing for the connector: its messages go to the handler from now on. Called when the connector starts connecting.
void Start(IDataFeedConnector connector, Action<TMessage> handler)
Parameters
connectorIDataFeedConnectorThe connector.
handlerAction<TMessage>Processes a message of the connector on the queue's thread.
Stop(IDataFeedConnector)
Stops processing for the connector. Called when the connector ends up disconnected (not on a connection loss that is followed by a reconnection).
void Stop(IDataFeedConnector connector)
Parameters
connectorIDataFeedConnectorThe connector.
Events
Heartbeat
Raised on the queue's thread every HeartbeatTimeout while the queue runs.
Added in ATAS 8.0.15.
event Action? Heartbeat
Event Type
- Action