private void findOrCreateWorker(String symbol, LiveConnectionSubscriber subscriber, LiveConnectors variant) { //search for worker which already loads the relevant data PushWorker worker = findWorker(symbol, variant); //create worker only in case of new symbol if (worker == null) { worker = new PushWorker(variant, symbol); DBUpdater dbUpdater = new DBUpdater(); //stash objects for later use listOfPushWorkers.Add(worker); listOfDBUpdaters.Add(dbUpdater); //subscribe dedicated mySQL-Connector to keep DB up-to-date worker.subscribe(dbUpdater); //initialize worker, tell him to load worker.startWork(); } //subscribe interested Object (e.g. table, chart, etc.) worker.subscribe(subscriber); }
public void unsubscribe(LiveConnectionSubscriber subscriber) { listOfSubscribers.Remove(subscriber); }
public void subscribeForLiveConnection(String symbol, LiveConnectionSubscriber subscriber, LiveConnectors variant) { findOrCreateWorker(symbol, subscriber, variant); }
public void subscribe(LiveConnectionSubscriber subscriber) { listOfSubscribers.Add(subscriber); Logger.log("(" + symbol + ") Added Subscriber: " + subscriber.ToString().Replace("AQM_Algo_Trading_Addin_CGR.", "")); }