public void Process(DeletionRequestReceived deletionRequest, EffectTracker effects) { int numberInstancesDeleted = 0; if (this.OrchestrationState != null && (!deletionRequest.CreatedTime.HasValue || deletionRequest.CreatedTime.Value == this.OrchestrationState.CreatedTime)) { this.OrchestrationState = null; numberInstancesDeleted++; // we also delete this instance's history, and pending operations on it effects.Add(TrackedObjectKey.History(this.InstanceId)); effects.Add(TrackedObjectKey.Sessions); } if (!effects.IsReplaying) { this.Partition.Send(new DeletionResponseReceived() { ClientId = deletionRequest.ClientId, RequestId = deletionRequest.RequestId, NumberInstancesDeleted = numberInstancesDeleted, }); } }
public void Process(CreationRequestReceived creationRequestReceived, EffectTracker effects) { bool filterDuplicate = this.OrchestrationState != null && creationRequestReceived.DedupeStatuses != null && creationRequestReceived.DedupeStatuses.Contains(this.OrchestrationState.OrchestrationStatus); if (!filterDuplicate) { var ee = creationRequestReceived.ExecutionStartedEvent; // set the orchestration state now (before processing the creation in the history) // so that this new instance is "on record" immediately - it is guaranteed to replace whatever is in flight this.OrchestrationState = new OrchestrationState { Name = ee.Name, Version = ee.Version, OrchestrationInstance = ee.OrchestrationInstance, OrchestrationStatus = OrchestrationStatus.Pending, ParentInstance = ee.ParentInstance, Input = ee.Input, Tags = ee.Tags, CreatedTime = ee.Timestamp, LastUpdatedTime = DateTime.UtcNow, CompletedTime = Core.Common.DateTimeUtils.MinDateTime, ScheduledStartTime = ee.ScheduledStartTime }; // queue the message in the session, or start a timer if delayed if (!ee.ScheduledStartTime.HasValue) { effects.Add(TrackedObjectKey.Sessions); } else { effects.Add(TrackedObjectKey.Timers); } } if (!effects.IsReplaying) { // send response to client effects.Partition.Send(new CreationResponseReceived() { ClientId = creationRequestReceived.ClientId, RequestId = creationRequestReceived.RequestId, Succeeded = !filterDuplicate, ExistingInstanceOrchestrationStatus = this.OrchestrationState?.OrchestrationStatus, }); } }
public override void DetermineEffects(EffectTracker effects) { // the last-added effects are processed first // so they can set the Purged list to contain only the instance ids that are actually purged effects.Add(TrackedObjectKey.Queries); effects.Add(TrackedObjectKey.Sessions); this.Purged = new List <string>(); foreach (string instanceId in this.InstanceIds) { effects.Add(TrackedObjectKey.Instance(instanceId)); } }
public void Process(ClientRequestEventWithPrefetch clientRequestEvent, EffectTracker effects) { if (clientRequestEvent.Phase == ClientRequestEventWithPrefetch.ProcessingPhase.Read) { this.Partition.Assert(!this.PendingPrefetches.ContainsKey(clientRequestEvent.EventIdString)); // Issue a read request that fetches the instance state. // We have to buffer this request in the pending list so we can recover it. this.PendingPrefetches.Add(clientRequestEvent.EventIdString, clientRequestEvent); if (!effects.IsReplaying) { this.Partition.SubmitInternalEvent(new InstanceLookup(clientRequestEvent)); } } else { if (this.PendingPrefetches.Remove(clientRequestEvent.EventIdString)) { if (clientRequestEvent.Phase == ClientRequestEventWithPrefetch.ProcessingPhase.ConfirmAndProcess) { effects.Add(clientRequestEvent.Target); } } } }
public void Process(PurgeBatchIssued purgeBatchIssued, EffectTracker effects) { OrchestrationState state = this.OrchestrationState; if (this.OrchestrationState != null && purgeBatchIssued.InstanceQuery.Matches(this.OrchestrationState)) { this.OrchestrationState = null; purgeBatchIssued.Purged.Add(this.InstanceId); effects.Add(TrackedObjectKey.History(this.InstanceId)); } }
public override void DetermineEffects(EffectTracker effects) { effects.Add(TrackedObjectKey.Dedup); }
public sealed override void DetermineEffects(EffectTracker effects) { effects.Add(TrackedObjectKey.Prefetch); }
public override void DetermineEffects(EffectTracker effects) { effects.Add(TrackedObjectKey.Reassembly); }