0

I am working on ASP.NET Web Application with C#. Kindly go through the Flowchart of the process.

Now, what I want is that a client sends a request to Server1 and Server1 requests Server2. I want the latter request to be asynchronous. I want Server1 to respond immediately to client before even getting response from Server2.

UPDATE: I have been working on async and await, unable to understand (with a simplest example) the work around.

All I understood is that async tells that the function is asynchronous and contains await statement which is asynchonously executed.

I don't find any reason for why people are downvoting my question. If you do, kindly let me know.

Community
  • 1
  • 1
vat69
  • 123
  • 1
  • 10
  • If _"Server1 to respond immediately to client before even getting response from Server2"_, how are you going to return a "task complete" response to the client? –  Jun 20 '17 at 05:49
  • @MickyD because the tasks done between Server1 and Server2 are irrelevant from the request (original form filled) of the client. Its status update kinda thing where client is notified of the Insertion while actual status is changed to several others as per Server2. – vat69 Jun 20 '17 at 05:57
  • You're missing the point. Pretty sure a typical web request can only return a single status/result –  Jun 20 '17 at 06:50
  • @MickyD the response from Server2 for request of Server1 will not be notified to User. It will be updated only in the database. – vat69 Jun 20 '17 at 06:54
  • It's because you don't show effort in solving your problem. If you show effort, people might not downvote this. – ItamarG3 Jun 20 '17 at 12:01
  • @ItamarGreen ah...well, that's Ok. If some people here are good at identifying syntax and code errors only, then no problem. I have the logic, I cannot disclose what I am working on, such situation won't be a problem to me if I am asked something like this. I would help anyways by understanding the logic and will ask to explain if I fail to understand, unlike the downvoters here. #Kudos – vat69 Jun 20 '17 at 13:54
  • You missed the point. Read the [ask] page. It has handy tips. – ItamarG3 Jun 20 '17 at 13:55
  • Got it. Thanks all the downvoters. – vat69 Jun 20 '17 at 14:16
  • and @deezg, can you actually just write once what you've understood and failed to understand, what is actually unclear to you that you'd to downvote? – vat69 Jun 21 '17 at 08:52
  • i didnt downvote nor am i interested in that topic. my point was in energy allocation;) – dee zg Jun 21 '17 at 09:22
  • :D how did you delete my comments anyways ?? – vat69 Jun 21 '17 at 13:17

1 Answers1

1

this is a classic example where you should use queues. when you receive request from client you put a task (request to server 2, update db, whatever) into queue and immediately respond to client. additionaly, you have queue consumer (windows service or something) that reads tasks from queue and execute them.

dee zg
  • 13,793
  • 10
  • 42
  • 82