| | | 1 | | using System.Text.Json.Serialization; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Workflows.Runtime; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Typed payload recorded in the per-instance workflow execution log whenever an execution cycle is force-cancelled |
| | | 7 | | /// by the runtime. Stored under <see cref="WorkflowInterruptedEventName"/>. |
| | | 8 | | /// </summary> |
| | | 9 | | /// <remarks> |
| | | 10 | | /// The <see cref="ExecutionCycleDuration"/> property is serialized under the JSON key <c>"BurstDuration"</c> for |
| | | 11 | | /// backwards compatibility — that key was already present in records persisted by pre-merge testers of this PR |
| | | 12 | | /// before the execution cycle → execution-cycle rename, and we preserve it so existing rows continue to deserialize. Th |
| | | 13 | | /// property name uses the new vocabulary; the wire format keeps the old one. |
| | | 14 | | /// </remarks> |
| | 8 | 15 | | public sealed record WorkflowInterruptedPayload( |
| | 6 | 16 | | DateTimeOffset InterruptedAt, |
| | 8 | 17 | | string Reason, |
| | 3 | 18 | | string GenerationId, |
| | 10 | 19 | | string? LastActivityId, |
| | 6 | 20 | | string? LastActivityNodeId, |
| | 4 | 21 | | string? IngressSourceName, |
| | 11 | 22 | | [property: JsonPropertyName("BurstDuration")] TimeSpan ExecutionCycleDuration) |
| | | 23 | | { |
| | | 24 | | /// <summary>Stable event name used on <c>WorkflowExecutionLogRecord.EventName</c>.</summary> |
| | | 25 | | public const string WorkflowInterruptedEventName = "WorkflowInterrupted"; |
| | | 26 | | |
| | | 27 | | /// <summary>Reason discriminator: a drain deadline elapsed while execution cycles were still running.</summary> |
| | | 28 | | public const string ReasonDeadlineBreach = "DeadlineBreach"; |
| | | 29 | | |
| | | 30 | | /// <summary>Reason discriminator: an operator invoked the admin force-drain endpoint.</summary> |
| | | 31 | | public const string ReasonOperatorForce = "OperatorForce"; |
| | | 32 | | |
| | | 33 | | /// <summary>Reason discriminator: the persistence layer was unavailable when the drain tried to commit the cycle's |
| | | 34 | | public const string ReasonPersistenceFailure = "PersistenceFailure"; |
| | | 35 | | } |