public override void OnNext(IEnvelope value)
 {
     if (value == null)
     {
         return;
     }
     try
     {
         TRecord record = CreateRecord(value);
         if (record != null)
         {
             _batch.Add(new Envelope <TRecord>(record, value.Timestamp, value.BookmarkData, value.Position));
         }
     }
     catch (Exception ex)
     {
         _logger?.LogError(ex, "Batching error");
     }
     finally
     {
         value.Dispose();
     }
 }