private void UploadMemoryStream(string fileNameWithoutPath, Stream stream, long channelID) { LogDataParameterMessage lp = new LogDataParameterMessage(); lp.FileName = fileNameWithoutPath; lp.SystemPassPhrase = _systemPassPhrase; lp.UserGUID = _userGUID; lp.MachineGUID = _machineGUID; lp.ChannelID = channelID.ToString(); lp.LogFileStream = stream; _logger.WriteTimestampedMessage("Filename without path: " + fileNameWithoutPath); SimpleErrorWrapperMessage sw = null; try { sw = _userDataMarshallerStreamerClient.ProcessLogData(lp); } catch (CommunicationException ex) { throw ex; } if (sw.ErrorStatus == ErrorStatus.Failure) { throw new RemoteServerException(sw.ErrorCode, sw.ErrorSeverity.ToString(), sw.Message); } }
private void LogDataFile(LogDataParameterMessage logDataParameterMessage) { var clientDataLogger = new ClientDataLogger(); switch (logDataParameterMessage.ChannelID) { case "-1": clientDataLogger.LogAdImpressionOrClickChannelProportion( logDataParameterMessage.FileName == "i_d_a.dat" ? _adImpressionsChannelProportionsLogger : _adClicksChannelProportionsLogger, logDataParameterMessage.MachineGUID, logDataParameterMessage.LogFileStream); break; case "-2": clientDataLogger.LogGeneralUsage(_generalUsageLogger, logDataParameterMessage.LogFileStream); TryLogLastImpressionToDB(logDataParameterMessage.MachineGUID); break; default: ILog log; if (logDataParameterMessage.FileName == "i_d_a.dat") { //We do not always receive these so log LastImpression when we recieve General Usage file instead //TryLogLastImpressionToDB(logDataParameterMessage.MachineGUID); log = _impressionsLogger; } else { TryLogLastClickToDB(logDataParameterMessage.MachineGUID); log = _clicksLogger; } clientDataLogger.LogImpressionsOrClicks(log, logDataParameterMessage.MachineGUID, logDataParameterMessage.ChannelID, logDataParameterMessage.LogFileStream); break; } }
/// <summary> /// Receives log data from the client /// </summary> /// <param name="logDataParameterMessage">Message Wrapper that holds the system pass phrase, the user's GUID, the asset type, the log type and the stream with the log file</param> /// <returns>A SimpleErrorWrapperMessage object with the operation result</returns> public SimpleErrorWrapperMessage ProcessLogData(LogDataParameterMessage logDataParameterMessage) { SimpleErrorWrapperMessage simpleErrorWrapper = new SimpleErrorWrapperMessage(); if (logDataParameterMessage.SystemPassPhrase != _systemPassPhrase) { simpleErrorWrapper.ErrorCode = "ERR:001"; simpleErrorWrapper.Message = "Authentication failure"; simpleErrorWrapper.ErrorSeverity = ErrorSeverity.Retriable; simpleErrorWrapper.ErrorStatus = ErrorStatus.Failure; return(simpleErrorWrapper); } try { LogDataFile(logDataParameterMessage); } catch (Exception ex) { _applicationLog.Error(ex.ToString()); } return(simpleErrorWrapper); }
public SimpleErrorWrapperMessage ProcessLogData(LogDataParameterMessage logDataParameterMessage) { return(Channel.ProcessLogData(logDataParameterMessage)); }