BasketRoutingManager
Default implementation of IBasketRoutingManager. Manages message routing logic for basket adapter.
构造函数
BasketRoutingManager(IAdapterConnectionState, IAdapterConnectionManager, IPendingMessageState, ISubscriptionRoutingState, IParentChildMap, IOrderRoutingState, Func<IMessageAdapter, IMessageAdapter>, CandleBuilderProvider, Func<bool>, IdGenerator, ILogReceiver, IAdapterRouter)
Initializes a new instance of BasketRoutingManager.
属性
ConnectDisconnectEventOnFirstAdapter : bool
To call the ConnectMessage event when the first adapter connects. If , waits for all adapters to connect.
ConnectedCount : int
Gets the count of connected adapters.
HasPendingAdapters : bool
Whether any adapter is still connecting.
TransactionIdGenerator : IdGenerator
Transaction id generator used for internal child subscription routing. Must be kept in sync with the parent adapter's generator.
方法
AddOrderAdapter(long, IMessageAdapter)
Add order transaction to adapter mapping.
ApplyParentLookupId(ISubscriptionIdMessage) : bool
Apply parent lookup ID remapping to subscription message.
返回值: if no valid parent found and message should be dropped.
BeginConnect()
Sets basket state to connecting.
BeginDisconnect()
Sets basket state to disconnecting.
CreateDefault(Func<IMessageAdapter, IMessageAdapter>, CandleBuilderProvider, Func<bool>, IdGenerator, ILogReceiver) : BasketRoutingManager
Creates a new instance of BasketRoutingManager with default state components.
GetAdaptersToDisconnect(Func<IMessageAdapter, IMessageAdapter>) : IDictionary<IMessageAdapter, IMessageAdapter>
Get adapters that need to be disconnected.
- adapterLookup
- Function to get wrapper from underlying adapter.
返回值: Dictionary of wrapper to underlying adapter.
GetPortfolioAdapter(string, Func<IMessageAdapter, IMessageAdapter>) : IMessageAdapter
Get adapter for portfolio-based routing.
- portfolioName
- Portfolio name.
- getWrapper
- Function to resolve wrapper adapter from underlying adapter.
返回值: Found adapter or null.
GetSubscribers(DataType) : long[]
Get subscriber IDs for a data type.
InitializeAdapter(IMessageAdapter)
Initializes adapter state before connecting.
LoadPortfolioAdapters(IEnumerable<ValueTuple<string, IMessageAdapter>>)
Clear and load portfolio adapter mappings.
LoadSecurityAdapters(IEnumerable<ValueTuple<ValueTuple<SecurityId, DataType>, IMessageAdapter>>)
Clear and load security adapter mappings.
OnAdapterRemoved(IMessageAdapter)
Called when an adapter is removed from the inner adapters list.
OnAdaptersCleared()
Called when all adapters are cleared from the inner adapters list.
OnPortfolioAdapterProviderChanged(string, Guid, bool, Func<Guid, IMessageAdapter>)
Handle portfolio adapter provider change.
OnSecurityAdapterProviderChanged(ValueTuple<SecurityId, DataType>, Guid, bool, Func<Guid, IMessageAdapter>)
Handle security adapter provider change.
ProcessBackMessage(IMessageAdapter, ISubscriptionMessage, Func<IMessageAdapter, IMessageAdapter>)
Process a back message with subscription tracking.
ProcessConnect(IMessageAdapter, IMessageAdapter, IEnumerable<MessageTypes>, Exception) : ValueTuple<IEnumerable<Message>, Message[], Message[]>
Process successful or failed connection.
- adapter
- The adapter that connected.
- wrapper
- The wrapper for the adapter.
- supportedMessages
- Supported message types.
- error
- Connection error if any.
返回值: Extra messages to send out and pending messages to loop back.
ProcessDisconnect(IMessageAdapter, IMessageAdapter, IEnumerable<MessageTypes>, Exception) : IEnumerable<Message>
Process disconnection.
- adapter
- The adapter that disconnected.
- wrapper
- The wrapper for the adapter.
- supportedMessages
- Supported message types.
- error
- Disconnection error if any.
返回值: Extra messages to send out.
ProcessInMessageAsync(Message, Func<IMessageAdapter, IMessageAdapter>, CancellationToken) : ValueTask<RoutingInResult>
Process an incoming message and determine routing decisions.
ProcessOutMessageAsync(IMessageAdapter, Message, Func<IMessageAdapter, IMessageAdapter>, CancellationToken) : ValueTask<RoutingOutResult>
Process an outgoing message from an inner adapter.
TryGetOrderAdapter(long, IMessageAdapter) : bool
Try get adapter for order by transaction id.