private static void Main(string[] args) { string address = ConfigurationManager.AppSettings["ServerAddress"]; string snapshotaddress = ConfigurationManager.AppSettings["SnapshotServerAddress"]; string gatewayaddress = ConfigurationManager.AppSettings["GatewayServerAddress"]; var snapshotServer = new NetMqSnapshotServer(snapshotaddress, CreateSnapshot); snapshotServer.Start(); var publisher = new NetMqPublisher(address); publisher.Start(); var gateway = new NetMqPushAcceptor(gatewayaddress); gateway.Subscribe("q", message => { Quote q = BinarySerializer <Quote> .DeSerializeFromByteArray(message); QuotesCache[q.InstrumentId] = q; publisher.Publish("q", message); }); gateway.Start(); Console.ReadKey(); }
public void Start() { //Debug.WriteLine(TimerResolution.SetResolution(500)); _processor = new FeedProcessor(OnValidQuote, OnInvalidQuote); _processor.Start(); _snapshotServer = new NetMqSnapshotServer(_snapshotAddress, CreateSnapshot); _snapshotServer.Start(); _publisher = new NetMqPublisher(_publisherAddress); _publisher.Start(); _gateway = new NetMqPushAcceptor(_gatewayAddress); _gateway.Subscribe(Constants.QuotesTopicName, message => { //TODO: try use protobuff var rawQuotes = BinarySerializer <IEnumerable <Quote> > .DeSerializeFromByteArray(message); _processor.ProcessQuotes(rawQuotes); }); _gateway.Start(); }
public IEnumerable <Quote> GetAndParseSnapshot(string topic) { return(BinarySerializer <IEnumerable <Quote> > .DeSerializeFromByteArray(base.GetSnapshot(topic))); }