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); } } }
public void Send(PartitionUpdateEvent updateEvent) { this.EventDetailTracer?.TraceEventProcessingDetail($"Sending partition update event {updateEvent} id={updateEvent.EventId}"); // trace DTFx TaskMessages that are sent or re-sent to other participants foreach (var entry in updateEvent.TracedTaskMessages) { this.Assert(!string.IsNullOrEmpty(entry.workItemId)); this.WorkItemTraceHelper.TraceTaskMessageSent(this.PartitionId, entry.message, entry.workItemId, updateEvent.EventIdString); } this.BatchSender.Submit(updateEvent); }
public void SubmitInternalEvent(PartitionUpdateEvent updateEvent) { // for better analytics experience, trace DTFx TaskMessages that are "sent" // by this partition to itself the same way as if sent to other partitions foreach (var entry in updateEvent.TracedTaskMessages) { this.Assert(!string.IsNullOrEmpty(entry.workItemId)); this.WorkItemTraceHelper.TraceTaskMessageSent(this.PartitionId, entry.message, entry.workItemId, updateEvent.EventIdString); } updateEvent.ReceivedTimestamp = this.CurrentTimeMs; this.State.SubmitInternalEvent(updateEvent); }