private static int UnpackRecordsFromDelimitedProtocolBuffers(Stream ProtocolBufferStream, string InLandingZone, string ReadableRequestString) { var UnpackedRecordCount = 0; DataRouterConsumer Consumer = new DataRouterConsumer(); // Expect one or more pairs of varint size + protocol buffer in the stream while (ProtocolBufferStream.Position < ProtocolBufferStream.Length) { DataRouterConsumer.ProtocolBufferRecord Message; if (!Consumer.TryParse(ProtocolBufferStream, out Message)) { string FailString = "! Protocol buffer parse fail in UnpackRecordsFromDelimitedProtocolBuffers(): " + ReadableRequestString; FailString += '\n' + Consumer.LastError; CrashReporterProcessServicer.WriteFailure(FailString); CrashReporterProcessServicer.StatusReporter.IncrementCount(StatusReportingEventNames.ReadS3FileFailedEvent); break; } if (DecompressDataRouterContent(Message.Payload, InLandingZone)) { UnpackedRecordCount++; } } return(UnpackedRecordCount); }
private static int UnpackRecordsFromDelimitedProtocolBuffers(Stream ProtocolBufferStream, string InLandingZone, string ReadableRequestString) { var UnpackedRecordCount = 0; DataRouterConsumer Consumer = new DataRouterConsumer(); // Expect one or more pairs of varint size + protocol buffer in the stream while (ProtocolBufferStream.Position < ProtocolBufferStream.Length) { DataRouterConsumer.ProtocolBufferRecord Message; if (!Consumer.TryParse(ProtocolBufferStream, out Message)) { string FailString = "! Protocol buffer parse fail in UnpackRecordsFromDelimitedProtocolBuffers(): " + ReadableRequestString; FailString += '\n' + Consumer.LastError; CrashReporterProcessServicer.WriteFailure(FailString); CrashReporterProcessServicer.StatusReporter.IncrementCount(StatusReportingEventNames.ReadS3FileFailedEvent); break; } if (DecompressDataRouterContent(Message.Payload, InLandingZone)) { UnpackedRecordCount++; } } return UnpackedRecordCount; }