protected override void OnCommandBatch(IEnumerable <Command> commands)
        {
            var records = commands.Select(ToJournalRecord).ToArray();

            _serializer.WriteObject(_journalStream, records);
            RecordsWritten.Invoke(records);
        }
Exemple #2
0
        protected override void OnCommandBatch(IEnumerable <Command> commands)
        {
            var records = commands.Select(ToJournalRecord).ToArray();

            foreach (var chunk in records.Split(_pageSize - _writtenRecords, _pageSize))
            {
                using (var stream = Open(_writtenRecords + chunk.Length < _pageSize))
                {
                    _serializer.WriteObject(stream, chunk);

                    _writtenRecords += chunk.Length;

                    if (_writtenRecords >= _pageSize)
                    {
                        _writtenRecords = 0;
                    }
                }
            }

            RecordsWritten.Invoke(records);
        }