| | | 1 | | using Elsa.Workflows.Helpers; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Workflows.Runtime; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// A message that can be delivered to a workflow instance. |
| | | 7 | | /// </summary> |
| | | 8 | | [Obsolete("This class will be removed in a future version.")] |
| | | 9 | | public class NewWorkflowInboxMessage |
| | | 10 | | { |
| | 0 | 11 | | private static readonly TimeSpan DefaultTimeToLive = TimeSpan.FromMinutes(1); |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// The type name of the activity to deliver the message to. |
| | | 15 | | /// </summary> |
| | 0 | 16 | | public string ActivityTypeName { get; set; } = default!; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// An optional bookmark payload that can be used to filter the workflow instances to deliver the message to. |
| | | 20 | | /// </summary> |
| | 0 | 21 | | public object BookmarkPayload { get; set; } = default!; |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// An optional workflow instance ID to select the workflow instance to deliver the message to. |
| | | 25 | | /// </summary> |
| | 0 | 26 | | public string? WorkflowInstanceId { get; set; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// An optional activity instance ID to select the workflow instance to deliver the message to. |
| | | 30 | | /// </summary> |
| | 0 | 31 | | public string? ActivityInstanceId { get; set; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// An optional correlation ID to select the workflow instance to deliver the message to. |
| | | 35 | | /// </summary> |
| | 0 | 36 | | public string? CorrelationId { get; set; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// An optional set of inputs to deliver to the workflow instance. |
| | | 40 | | /// </summary> |
| | 0 | 41 | | public IDictionary<string, object>? Input { get; set; } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// The duration after which the message expires. |
| | | 45 | | /// </summary> |
| | 0 | 46 | | public TimeSpan TimeToLive { get; set; } = DefaultTimeToLive; |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Creates a new instance of the <see cref="NewWorkflowInboxMessage"/> class. |
| | | 50 | | /// </summary> |
| | | 51 | | /// <param name="bookmarkPayload">The bookmark payload to use to filter the workflow instances to deliver the messag |
| | | 52 | | /// <param name="workflowInstanceId">An optional workflow instance ID to select the workflow instance to deliver the |
| | | 53 | | /// <param name="correlationId">An optional correlation ID to select the workflow instance to deliver the message to |
| | | 54 | | /// <param name="activityInstanceId">An optional activity instance ID to select the workflow instance to deliver the |
| | | 55 | | /// <param name="input">An optional set of inputs to deliver to the workflow instance.</param> |
| | | 56 | | /// <param name="timeToLive">The duration after which the message expires.</param> |
| | | 57 | | /// <typeparam name="T">The type of the activity to deliver the message to.</typeparam> |
| | | 58 | | /// <returns>A new instance of the <see cref="NewWorkflowInboxMessage"/> class.</returns> |
| | | 59 | | public static NewWorkflowInboxMessage For<T>( |
| | | 60 | | object bookmarkPayload, |
| | | 61 | | string? workflowInstanceId = default, |
| | | 62 | | string? correlationId = default, |
| | | 63 | | string? activityInstanceId = default, |
| | | 64 | | IDictionary<string, object>? input = default, |
| | | 65 | | TimeSpan? timeToLive = default) where T : IActivity |
| | | 66 | | { |
| | 0 | 67 | | return new NewWorkflowInboxMessage |
| | 0 | 68 | | { |
| | 0 | 69 | | Input = input, |
| | 0 | 70 | | BookmarkPayload = bookmarkPayload, |
| | 0 | 71 | | CorrelationId = correlationId, |
| | 0 | 72 | | WorkflowInstanceId = workflowInstanceId, |
| | 0 | 73 | | ActivityInstanceId = activityInstanceId, |
| | 0 | 74 | | ActivityTypeName = ActivityTypeNameHelper.GenerateTypeName<T>(), |
| | 0 | 75 | | TimeToLive = timeToLive ?? DefaultTimeToLive, |
| | 0 | 76 | | }; |
| | | 77 | | } |
| | | 78 | | } |