question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please help. How to handle multiple requests by different users which one is which

See original GitHub issue

Hello @sfmskywalker,

I do not want to use signal activity.

I have implemented Employee leave workflow. Where multiple employee can submit leave request to their managers.

Let me explain through example. when employee1 generate request which is now waiting for approval. The 2nd employee2 generate request. Every thing is fine but when any manager perform action on leave request all other requests are moved to Fault State. I am setting correlation Id and also checking for correct correlate Id. I can’t handle multiple requests. I have attached workflow with this post.

I will make your life easy. Just import attached workflow and perform below employee actions using Postman.

Employee 1 Leave Request Post Below Json data using Postman Post URI: http://localhost:5683/leaverequest

{
     "WorkflowId":"Leave_1",
    "RecordId": "1",
    "EntityName":"EmployeeLeave",
    "Applicant": {"Name": "Employee1", "Email": "qamar@abc.com"},
    "Sender": {" Name": "Employee1", "Email": "qamar@abc.com"},
    "Recipient": {"Name":"manager", "Email":"manager@abc.com"},
    "Action": "Initiated",
    "WorkflowStatus": "Start",
    "WorkflowDescription": "Leave Application submitted by ${Request.Sender.Name}",
    "Remarks": "Urgent work at home"
}

WorkflowId: is used to set correlation id RecordId: Employee leave record id Action: user action performed possible actions (Initiated, Rejected, Forwarded, Withdrawn, Deleted, Approved etc.) WorkflowStatus: the state of workflow which is used by our application possible states (Start, InProgress, Correction, Denied, Canceled, Complete etc.) Employee 2 Leave Request

Post URI: http://localhost:5683/leaverequest

{
	"WorkflowId":"Leave_2",
    "RecordId": "2",
    "EntityName":"EmployeeLeave",
    "Applicant": {"Name": "Employee2", "Email": "employee2@abc.com"},
    "Sender": {" Name": "Employee2", "Email": "employee2@abc.com"},
    "Recipient": {"Name":"manager", "Email":"manager@abc.com"},
    "Action": "Initiated",
    "WorkflowStatus": "Start",
    "WorkflowDescription": "Leave Application submitted by Employee2",
    "Remarks": "Urgent work at home"
}

No issues till now but when manager perform action all other requests are moved to Fault state. Lets do it

Manager Action When manager perform action on any request Post action request on the following Uri Note action URL is change Post URI: http://localhost:5683/leaveaction

{
	"WorkflowId":"Leave_2",
    "RecordId": "2",
    "EntityName":"EmployeeLeave",
    "Applicant": {"Name": "Employee2", "Email": "employee2@abc.com"},
    "Sender": {" Name": "manager", "Email": "manager@abc.com"},
    "Recipient": {"Name":"Employee2", "Email":"employee2@abc.com"},
    "Action": "Approved",
    "WorkflowStatus": "Complete",
    "WorkflowDescription": "Leave Application submitted by Employee2",
    "Remarks": "Urgent work at home"
}

Due to manager action all other requests are moved to Fault state. Only one request that is performed by Manager is fulfilled others are in Fault State.

I do not know how to use UserTask activity. I tried to use Trigger activity but without any luck.

Please help how to use Httprequest with user actions with multiple employee requests.

I highly appreciate your help

workflow.(14).json.txt

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sniperwolfpk5commented, Mar 19, 2020

Hi @sfmskywalker,

Yes you are right it will not work on all cases. Also it is not efficient way because it loops through all instances. A correlationId or workflow instance Id would be ideal with HTTP request which will execute only instance based on workflow instance id or correlation id.

0reactions
sfmskywalkercommented, Mar 29, 2020

@sniperwolfpk5 I’m closing this issue because I think we’ve come to a good conclusion and created a separate issue to track development of it. Feel free to reopen this one if there’s anything we need to follow up on. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How does a web server handle multiple requests?
The web server can handle multiple requests simultaneously using a technique called "threading". Each incoming request is handled by a separate thread, allowing ......
Read more >
How can a web server handle multiple user's incoming ...
The server opens a socket that 'listens' at port 80 and 'accepts' new connections from that socket. Each new connection is represented by...
Read more >
How Does Python Handle Multiple Web Requests
One way you can handle multiple requests is to have multiple physical servers. Each request can be given to a server that is...
Read more >
How does TCP handle multiple requests targeted to one ...
1 Answer 1 · Pipelining – the client can submit multiple requests in a specific order, and the responses arrive in exactly the...
Read more >
I'm confused about how does a Spring Boot Web Service ...
If multiple concurrent requests are made to the application server, those requests will be queued on a single thread. I believe the thread's ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found