Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpEndpoint Activity Performance - allow direct response and process other steps asynchronously #4701

Open
jdevillard opened this issue Dec 13, 2023 · 0 comments
Labels
elsa 3 This issue is specific to Elsa 3 performance

Comments

@jdevillard
Copy link
Contributor

TLDR : We should offer a simple way to let the workflow write to the http response directly and perhaps resume asynchronously


After doing some test on HttpEndpoint Activity and WriteHttpResponse, here are my observations :

  • Elsa.Http.Middleware.WorkflowMiddleware is responsible to :
    • react to the Http Input (Path etc..)
    • found the Workflow to instanciate,
    • execute the Workflow Instance
    • Respond to the caller (return in the middleware)
  • WriteHttpResponse modify the HttpContext to allow the wokflow to customise the Response of the workflow

BUT even if we use the WriteHttpResponse at the begining of the workflow , the call to ExecuteWorkflowAsync is blocked and will be unblock only if workflow is suspended / finished.

So for example, a simple workflow HttpEndpoint -> HttpWriteResponse -> Delay 5Sec (blocking, without suspend state) , the response is received by the client at the end of the workflow so 5sec after the HttpWriteResponse.

Technically , this behavior can also lead to performance issue, due to any backend work that can be done by the framework (persistence etc...)

Another functional example is, HttpEndpoint -> doing some verification -> HttpWriteResponse (ok) -> doing some other work -> put the workflow in error state du to second step work issue. In this case, the Http Client receive a 500 error which is not necessary what we want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elsa 3 This issue is specific to Elsa 3 performance
Projects
Status: Todo
Development

No branches or pull requests

2 participants