void SendBatchOnceEventIsPersisted(PartitionUpdateEvent evt, EffectTracker effects, Batch batch)
        {
            // put the messages in the outbox where they are kept until actually sent
            var commitPosition = evt.NextCommitLogPosition;

            // Update the ready to send timestamp to check the delay caused
            // by non-speculation
            evt.ReadyToSendTimestamp = this.Partition.CurrentTimeMs;

            this.Outbox[commitPosition] = batch;
            batch.Position  = commitPosition;
            batch.Partition = this.Partition;

            if (!effects.IsReplaying)
            {
                if (!this.Partition.Settings.PersistStepsFirst)
                {
                    // we must not send messages until this step has been persisted
                    evt.OutboxBatch = batch;
                    DurabilityListeners.Register(evt, this);
                }
                else
                {
                    // we can send the messages now
                    this.Send(batch);
                }
            }
        }
 void Send(Batch batch)
 {
     // now that we know the sending event is persisted, we can send the messages
     foreach (var outmessage in batch.OutgoingMessages)
     {
         DurabilityListeners.Register(outmessage, batch);
         outmessage.OriginPartition = this.Partition.PartitionId;
         outmessage.OriginPosition  = batch.Position;
         //outmessage.SentTimestampUnixMs = DateTimeOffset.Now.ToUnixTimeMilliseconds();
         this.Partition.Send(outmessage);
     }
 }