public int Enqueue(string deviceId, string jsonData) { if (jsonData != null) //not filling a queue by empty items { QueuedItem sensorData = _dataTransform(deviceId, jsonData); if (sensorData != null) { //TODO: we can check status of BatchSender and indicate error on request if needed _queue.Push(sensorData); DataInQueue(sensorData); } } return(_queue.Count); }
protected virtual void DataInQueue(QueuedItem data) { DataInQueueEventHandler newData = OnDataInQueue; if (newData != null) { var sh = new SafeAction <QueuedItem>(d => newData(d), Logger); TaskWrapper.Run(() => sh.SafeInvoke(data)); } // // NO logging on production code, enable for diagnostic purposes for debugging // #if DEBUG_LOG LogMessageReceived( ); #endif }