private async Task TriggerWorkflowsAsync(Message message, CancellationToken cancellationToken) { var correlationId = message.CorrelationId; var model = new MessageModel { Body = message.Body, CorrelationId = message.CorrelationId, ContentType = message.ContentType, Label = message.Label, To = message.To, MessageId = message.MessageId, PartitionKey = message.PartitionKey, ViaPartitionKey = message.ViaPartitionKey, ReplyTo = message.ReplyTo, SessionId = message.SessionId, ExpiresAtUtc = message.ExpiresAtUtc, TimeToLive = message.TimeToLive, ReplyToSessionId = message.ReplyToSessionId, ScheduledEnqueueTimeUtc = message.ScheduledEnqueueTimeUtc, UserProperties = new Dictionary <string, object>(message.UserProperties), }; var bookmark = CreateBookmark(message); var trigger = CreateTrigger(message); var launchContext = new CollectWorkflowsContext(ActivityType, bookmark, trigger, correlationId); await _workflowLaunchpad.UseServiceAsync(service => service.CollectAndDispatchWorkflowsAsync(launchContext, model, cancellationToken)); }
private async Task TriggerWorkflowsAsync(MqttApplicationMessage message, CancellationToken cancellationToken) { var bookmark = CreateBookmark(_receiverClient.Options); var launchContext = new WorkflowsQuery(ActivityType, bookmark); await _workflowLaunchpad.UseServiceAsync(service => service.CollectAndDispatchWorkflowsAsync(launchContext, new WorkflowInput(message), cancellationToken)); }
private async Task TriggerWorkflowsAsync(TransportMessage message, CancellationToken cancellationToken) { //avoid handler being triggered earlier than workflow is suspended await Task.Delay(_delay, cancellationToken); var config = _client.Configuration; var bookmark = new MessageReceivedBookmark(config.ExchangeName, config.RoutingKey, config.ConnectionString, config.Headers); var launchContext = new WorkflowsQuery(ActivityType, bookmark); await _workflowLaunchpad.UseServiceAsync(service => service.CollectAndDispatchWorkflowsAsync(launchContext, new WorkflowInput(message), cancellationToken)); }
private async Task <IEnumerable <TaskDefinition> > GetTasksAsync(CancellationToken cancellationToken) => await _scopedTasksProviders.UseServiceAsync(async taskProviders => await GetTasksAsync(taskProviders, cancellationToken).ToListAsync(cancellationToken));
private async Task <IEnumerable <CommandDefinition> > GetCommandsAsync(CancellationToken cancellationToken) => await _scopedCommandsProviders.UseServiceAsync(async commandProviders => await GetCommandsAsync(commandProviders, cancellationToken).ToListAsync(cancellationToken));
private async Task <IEnumerable <EventDefinition> > GetEventsAsync(CancellationToken cancellationToken) => await _scopedEventsProviders.UseServiceAsync(async eventProviders => await GetEventsAsync(eventProviders, cancellationToken).ToListAsync(cancellationToken));