|
| 1 | +// Copyright © 2024-Present The Synapse Authors |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"), |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// |
| 8 | +// Unless required by applicable law or agreed to in writing, software |
| 9 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +// See the License for the specific language governing permissions and |
| 12 | +// limitations under the License. |
| 13 | + |
| 14 | +namespace Synapse.Events.Tasks; |
| 15 | + |
| 16 | +/// <summary> |
| 17 | +/// Represents the data carried by the cloud event that notifies that a task has faulted |
| 18 | +/// </summary> |
| 19 | +[CloudEvent(SynapseDefaults.CloudEvents.Task.Faulted.v1)] |
| 20 | +public record TaskFaultedEventV1 |
| 21 | +{ |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// Gets/sets the qualified name of the workflow instance the task that has faulted belongs to |
| 25 | + /// </summary> |
| 26 | + [DataMember(Name = "workflow", Order = 1), JsonPropertyName("workflow"), JsonPropertyOrder(1), YamlMember(Alias = "workflow", Order = 1)] |
| 27 | + public required string Workflow { get; set; } |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Gets/sets the reference of the task that has faulted |
| 31 | + /// </summary> |
| 32 | + [DataMember(Name = "task", Order = 2), JsonPropertyName("task"), JsonPropertyOrder(2), YamlMember(Alias = "task", Order = 2)] |
| 33 | + public required Uri Task { get; set; } |
| 34 | + |
| 35 | + /// <summary> |
| 36 | + /// Gets/sets the error that has cause the task to fault |
| 37 | + /// </summary> |
| 38 | + [DataMember(Name = "error", Order = 3), JsonPropertyName("error"), JsonPropertyOrder(3), YamlMember(Alias = "error", Order = 3)] |
| 39 | + public required Error Error { get; set; } |
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Gets/sets the date and time at which the task has faulted |
| 43 | + /// </summary> |
| 44 | + [DataMember(Name = "faultedAt", Order = 4), JsonPropertyName("faultedAt"), JsonPropertyOrder(4), YamlMember(Alias = "faultedAt", Order = 4)] |
| 45 | + public DateTimeOffset FaultedAt { get; set; } = DateTimeOffset.Now; |
| 46 | + |
| 47 | +} |
0 commit comments