public bool AddChannelHandle(string id, MarketMessageType type, IUserChannelNotification channel) { CommandKey key = new CommandKey(type, id); bool firstHandle = false; if (!messageListeners.TryGetValue(key, out IEnumerable <IUserChannelNotification> list)) { list = new ConcurrentBag <IUserChannelNotification>(); messageListeners.TryAdd(key, list); firstHandle = true; } else { if (bookCache.TryGetValue(id, out BookMessageCache cache)) { channel.Arrived(cache.Snapshot()); } } if (!list.Contains(channel)) { ((ConcurrentBag <IUserChannelNotification>)list).Add(channel); } return(firstHandle); }
public CommandKey(MarketMessageType type, string id) { if (string.IsNullOrEmpty(id)) { throw new ArgumentException("'id' is not null"); } this.type = type; this.id = id; }
public bool RemoveChannelHandle(string id, MarketMessageType type, IUserChannelNotification channel) { CommandKey key = new CommandKey(type, id); if (messageListeners.TryGetValue(key, out IEnumerable <IUserChannelNotification> list)) { var tmp = list.ToList(); tmp.Remove(channel); if (!tmp.Any()) { messageListeners.Remove(key, out list); return(true); } } return(false); }
public MessageSerialize(MarketMessageType type) : base(type) { }
public MessageBase(MarketMessageType type) { this.type = type; }
public bool AllocatePostmanThread(string symbol, MarketMessageType type) { throw new NotImplementedException(); }
public void AddChannelHandle(string v, MarketMessageType mINI_BOOK, Func <object> p) { throw new NotImplementedException(); }