/// <summary> /// Logically speaking, when a document is deduplicated, we should have a /// handlestream of document created, because the handle is assigned to /// the correct <see cref="DocumentDescriptor"/> /// </summary> /// <param name="e"></param> public void On(DocumentDescriptorHasBeenDeduplicated e) { _streamReadModelCollection.Insert(e, new StreamReadModel() { Id = GetNewId(), Handle = e.HandleInfo.Handle, EventType = HandleStreamEventTypes.DocumentCreated, }); }
public void On(DocumentDescriptorHasBeenDeduplicated e) { var originalDocumentDescriptor = _documentDescriptorReader.AllUnsorted.Single(d => d.Id == e.AggregateId); _writer.DocumentDeDuplicated( e.HandleInfo.Handle, null, (DocumentDescriptorId)e.AggregateId, e.CheckpointToken ); }
public void verify_document_descriptor_de_duplicated_generates_record() { CreateSut(); var evt = new DocumentDescriptorHasBeenDeduplicated(new DocumentDescriptorId(2), new DocumentHandleInfo(new DocumentHandle("rev_2"), new FileNameWithExtension("test.pdf"))) .AssignIdForTest(new DocumentDescriptorId(1)); _sut.Handle(evt, false); Assert.That(rmStream, Has.Count.EqualTo(1)); Assert.That(rmStream[0].EventType, Is.EqualTo(HandleStreamEventTypes.DocumentCreated)); Assert.That(rmStream[0].Handle, Is.EqualTo("rev_2")); }
public void On(DocumentDescriptorHasBeenDeduplicated e) { if (IsReplay) { return; } _commandBus.Send(new LinkDocumentToDocumentDescriptor( (DocumentDescriptorId)e.AggregateId, e.HandleInfo) .WithDiagnosticTriggeredByInfo(e, "Document " + e.DuplicatedDocumentDescriptorId + " deduplicated to " + e.AggregateId) ); _commandBus.Send(new DeleteDocumentDescriptor(e.DuplicatedDocumentDescriptorId, DocumentHandle.Empty) .WithDiagnosticTriggeredByInfo(e, "deduplication of " + e.AggregateId) ); }