public void On(DocumentDescriptorInitialized e) { //need eager association with descriptor to correctly manage association //with attachment. _writer.CreateIfMissing( e.HandleInfo.Handle, e.Id, e.CheckpointToken ); }
public void On(DocumentDescriptorInitialized e) { if (IsReplay) { return; } var thisDocumentId = (DocumentDescriptorId)e.AggregateId; var duplicatedId = _deduplicationHelper.FindDuplicateDocumentId( thisDocumentId, e.Hash, e.BlobId ); var done = false; if (duplicatedId != null) { try { _commandBus.Send(new DeduplicateDocumentDescriptor( duplicatedId, thisDocumentId, e.HandleInfo) .WithDiagnosticTriggeredByInfo(e) ); done = true; } catch (DocumentDescriptorDeletedException ex) { Logger.ErrorFormat(ex, "Document cannot be deduplicated because {0} is marked for deletion", ex.AggregateId); } } if (!done) { _commandBus.Send(new CreateDocumentDescriptor(thisDocumentId, e.HandleInfo) .WithDiagnosticTriggeredByInfo(e) ); done = true; } if (e.FatherDocumentDescriptorId != null) { //This handle is created as attachment of another document. _commandBus.Send(new CreateAttachment( e.FatherDocumentDescriptorId, e.HandleInfo.Handle, e.HandleInfo.CustomData[JobsConstants.AttachmentRelativePath] as String) .WithDiagnosticTriggeredByInfo(e) ); } }
private void When(DocumentDescriptorInitialized e) { BlobId = e.BlobId; }