public void TearDown() { _bus = null; _manager = null; _correlationID = Guid.Empty; _prepareAck = null; _commitAck = null; }
public void Handle(ReplicationMessage.PrepareAck message) { if (_completed) { return; } _transactionId = message.LogPosition; CompleteSuccessRequest(_correlationId, _transactionId, _eventStreamId); }
public void SetUp() { _bus = new FakePublisher(); _manager = new TwoPhaseCommitRequestManager(_bus, 2, 2); _correlationID = Guid.NewGuid(); _manager.Handle(new ReplicationMessage.WriteRequestCreated(_correlationID, new NoopEnvelope(), "test-stream", -1, new Event[0])); _prepareAck = new ReplicationMessage.PrepareAck(_correlationID, 0, PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd); _commitAck = new ReplicationMessage.CommitAck(_correlationID, 0, 0); }
public void Handle(ReplicationMessage.PrepareAck message) { if (_completed) { return; } if ((message.Flags & PrepareFlags.TransactionBegin) != 0) { _preparePos = message.LogPosition; } if ((message.Flags & PrepareFlags.TransactionEnd) != 0) { _awaitingPrepare -= 1; if (_awaitingPrepare == 0) { _bus.Publish(new ReplicationMessage.WriteCommit(message.CorrelationId, _publishEnvelope, _preparePos)); _bus.Publish(TimerMessage.Schedule.Create(CommitTimeout, _publishEnvelope, new ReplicationMessage.CommitPhaseTimeout(_correlationId))); } } }
public void Handle(ReplicationMessage.PrepareAck message) { DispatchInternal(message.CorrelationId, message); }