public void Handle(ReplicationMessage.CreateStreamRequestCreated message) { var manager = new TwoPhaseCommitRequestManager(_bus, _prepareCount, _commitCount); _currentRequests.Add(message.CorrelationId, manager); manager.Handle(message); }
public void Handle(ReplicationMessage.DeleteStreamRequestCreated message) { // TODO AN: add idempotency of events on write var manager = new TwoPhaseCommitRequestManager(_bus, _prepareCount, _commitCount); _currentRequests.Add(message.CorrelationId, manager); manager.Handle(message); }
public void Handle(ReplicationMessage.WriteRequestCreated message) { // TODO AN verify the check for just the first event is sensible solution for idempotency int eventVersion; if (_commitedEvents.TryGetRecord(message.Events[0].EventId, out eventVersion)) { var response = new ClientMessage.WriteEventsCompleted(message.CorrelationId, message.EventStreamId, eventVersion); message.Envelope.ReplyWith(response); return; } var manager = new TwoPhaseCommitRequestManager(_bus, _prepareCount, _commitCount); _currentRequests.Add(message.CorrelationId, manager); manager.Handle(message); }