public void Handle(ReplicationMessage.TransactionWriteRequestCreated message)
        {
            var manager = new SingleAckRequestManager(_bus);

            _currentRequests.Add(message.CorrelationId, manager);
            manager.Handle(message);
        }
        public void Handle(ReplicationMessage.TransactionWriteRequestCreated request)
        {
            if (_initialized)
            {
                throw new InvalidOperationException();
            }

            _initialized      = true;
            _requestType      = RequestType.TransactionWrite;
            _responseEnvelope = request.Envelope;
            _correlationId    = request.CorrelationId;

            _transactionId = request.TransactionId;

            _bus.Publish(new ReplicationMessage.WriteTransactionData(request.CorrelationId,
                                                                     _publishEnvelope,
                                                                     _transactionId,
                                                                     request.EventStreamId,
                                                                     request.Events));
            CompleteSuccessRequest(request.CorrelationId, request.TransactionId, request.EventStreamId);
        }
        public void Handle(ReplicationMessage.TransactionWriteRequestCreated request)
        {
            if (_initialized)
            {
                throw new InvalidOperationException();
            }

            _initialized      = true;
            _requestType      = RequestType.TransactionWrite;
            _responseEnvelope = request.Envelope;
            _correlationId    = request.CorrelationId;

            _transactionId = request.TransactionId;

            _bus.Publish(new ReplicationMessage.WriteTransactionData(request.CorrelationId,
                                                                     _publishEnvelope,
                                                                     _transactionId,
                                                                     request.EventStreamId,
                                                                     request.Events));
            CompleteSuccessRequest(request.CorrelationId, request.TransactionId, request.EventStreamId);
//            _bus.Publish(TimerMessage.Schedule.Create(TwoPhaseCommitRequestManager.PrepareTimeout,
//                                                      _publishEnvelope,
//                                                      new ReplicationMessage.PreparePhaseTimeout(_correlationId)));
        }