1 year ago
#283181
Martin
Problem with resuming a custom build blocking activity
I am trying to create a blocking activity. When resuming the workflow, I call workflowLaunchpad.ExecutePendingWorkflowAsyc() and this call throws a System.ObjectDisposedException exception.
the callstack of the exception:
This exception was originally thrown at this call stack:
Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException()
Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(System.Type)
MediatR.ServiceFactoryExtensions.GetInstances<T>(MediatR.ServiceFactory)
MediatR.Internal.NotificationHandlerWrapperImpl<TNotification>.Handle(MediatR.INotification, System.Threading.CancellationToken, MediatR.ServiceFactory, System.Func<System.Collections.Generic.IEnumerable<System.Func<MediatR.INotification, System.Threading.CancellationToken, System.Threading.Tasks.Task>>, MediatR.INotification, System.Threading.CancellationToken, System.Threading.Tasks.Task>)
MediatR.Mediator.PublishNotification(MediatR.INotification, System.Threading.CancellationToken)
MediatR.Mediator.Publish<TNotification>(TNotification, System.Threading.CancellationToken)
Elsa.Services.Workflows.WorkflowRegistry.FindInternalAsync(System.Func<Elsa.Providers.Workflows.IWorkflowProvider, System.Threading.Tasks.ValueTask<Elsa.Services.Models.IWorkflowBlueprint>>, System.Threading.CancellationToken)
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
...
[Call Stack Truncated]
I am trying to call this from a API endpoint. The code is very simple, as I am only evaluating ELSA for one of my next project.
[Route("api/test")]
[ApiController]
public class TestController : ControllerBase
{
private ISharePointTaskInvoker invoker;
private IWorkflowLaunchpad workflowLaunchpad;
public TestController(ISharePointTaskInvoker invoker, IWorkflowLaunchpad workflowLaunchpad)
{
this.workflowLaunchpad = workflowLaunchpad;
this.invoker = invoker;
}
[HttpPost]
public async void Post(RequestData data)
{
var q = new WorkflowsQuery(nameof(SharePointTask), new SharePointTaskBookmark(), data.CorrelationId, data.WorkflowInstanceId);
IEnumerable<CollectedWorkflow> wfs = await workflowLaunchpad.FindWorkflowsAsync(q);
foreach(CollectedWorkflow wf in wfs)
{
await workflowLaunchpad.ExecutePendingWorkflowAsync(wf);
}
}
}
public class RequestData
{
public string WorkflowInstanceId { get; set; }
public string ActivityId { get; set; }
public string CorrelationId { get; set; }
}
Do you have an idea, what I am missing, that's causing this ObjectDisposedException?
elsa-workflows
0 Answers
Your Answer