public async Task Consume(ConsumeContext <T> context) { var message = context.Message; var activityType = nameof(ReceiveMassTransitMessage); var input = new Variables(); input.SetVariable(Constants.MessageInputKey, message); input.SetVariable(Constants.MessageTypeNameInputKey, typeof(T).AssemblyQualifiedName); Guid?correlationId = default; foreach (var item in CorrelationIdSelectors) { if (item.TryGetCorrelationId(message, out correlationId)) { break; } } await workflowInvoker.TriggerAsync( activityType, input, correlationId.ToString(), x => ReceiveMassTransitMessage.GetMessageType(x) == message.GetType(), context.CancellationToken); }
/// <summary> /// Starts new workflows that start with the specified activity name and resumes halted workflows that are blocked on activities with the specified activity name. /// </summary> public static Task TriggerAsync( this IWorkflowInvoker workflowInvoker, string activityType, Variables input, CancellationToken cancellationToken = default) { return(workflowInvoker.TriggerAsync(activityType, input, cancellationToken: cancellationToken)); }
public async Task Consume(ConsumeContext <T> context) { var message = context.Message; var activityType = nameof(ReceiveMassTransitMessage); var input = new Variables { ["message"] = message }; var correlationId = context.CorrelationId?.ToString(); await workflowInvoker.TriggerAsync( activityType, input, correlationId, x => ReceiveMassTransitMessage.GetMessageType(x) == message.GetType(), context.CancellationToken); }
public static async Task TriggerSignalAsync( this IWorkflowInvoker workflowInvoker, string signalName, Variables input = default, Func <JObject, bool> activityStatePredicate = null, string correlationId = default, CancellationToken cancellationToken = default) { var combinedInput = new Variables(); combinedInput.SetVariable("Signal", signalName); if (input != null) { combinedInput.SetVariables(input); } await workflowInvoker.TriggerAsync(nameof(Signaled), combinedInput, correlationId, activityStatePredicate, cancellationToken); }