Fire-and-Forget Workflow - Am I doing this wrong? #871
-
|
I'm mocking up a workflow which on average will run for a few minutes mostly doing background SQL operations. It will be invoked from an API whose client will get the The problem I'm having is that the I'm working with the latest 2.0 preview packages from MyGet. Here is my workflow: And the invoking controller: Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Currently, Elsa has two ways to execute workflows: the "core" API runs the workflow synchronously (i.e. not in the background). The other way is to run it from a background worker. To run a workflow from a background worker, you need to "dispatch" a workflow using By default, the There's also an Orleans dispatcher, but contrary to what I originally assumed, that one does not cause the workflow to be executed in the background. Which is one of the reasons I'm thinking about a small redesign of the way workflows get processed at the moment. Anyway, if you inject There is also |
Beta Was this translation helpful? Give feedback.
-
|
Here is my controller code in case it helps out anyone else: |
Beta Was this translation helpful? Give feedback.
Currently, Elsa has two ways to execute workflows: the "core" API runs the workflow synchronously (i.e. not in the background). The other way is to run it from a background worker. To run a workflow from a background worker, you need to "dispatch" a workflow using
IWorkflowDefinitionDispatcher, which means nothing more than sending a message or enqueueing a job, depending on which dispatch provider is installed.By default, the
QueueingWorkflowDispatcheris installed (in the DI service container), but when executing workflows that might take minutes to complete (while being in-memory), a better dispatcher might be theHangfireWorkflowDispatcher. That one enqueues a Hangfire job, which can…