Template for long tasks called through ASP.NET

I need to call a long-running task from an ASP.NET page and let the user view the progress of the tasks as they are completed.

In my current case, I want to import data from a series of data files into a database, but this requires a significant amount of processing. I would like the user to see how far the files are and what problems arose along the way.

Due to limited processing resources, I would like to queue requests for this service.

I recently looked at Windows Workflow and wondered if it could offer a solution.

I am thinking of a solution that might look like this:

ASP.NET AJAX page -> WCF Service -> MSMQ -> Workflow Service *or* Windows Service

Does anyone have any ideas, experience, or something like that before?

+4
source share
2 answers

I have a book that explicitly states how to integrate WF (WorkFlow) and WCF. Obviously, this is too much to post here. I think your question deserves a longer answer than you can easily answer this entire forum, but Microsoft offers some recommendations .

And a Google search for "WCF and WF" produces a lot of results.


I developed an application in which we used a similar process using MSMQ. The idea was to provide alarm messages to all our stores in the event of a product recall or known problems that affect a large number of stores. It was designed and tested by OK.

We ended up not using MSMQ due to business requirements - we needed to know if a message was received right away so we could call the store, and not just let the store receive it when their computer could pick up the message from the queue . However, it worked very well.

The article linked to above is a good place to start.


Our current design with which we live does exactly what you asked about the Windows service.

  • We have a web page for entering messages and selecting mailing lists. - they are stored in the database
  • We have a separate Windows service (we call it AlertSender) that polls the database and checks for new messages.
  • Storage-level computers have a Windows service that hosts a WCF client that listens for messages (AlertListener)
  • When AlertSender finds messages that need to be disabled, it sends them to AlertListener, which is responsible for displaying the message in stores and playing a sound signal.
  • When messages are sent, AlertSender updates the message status in the database.
  • When stores receive a message, an employee dials their employee # and presses a button to confirm that they received the message. (A critical business requirement is for us, because if all stores do not receive the message, we may need to physically call them so that they remove the infected product from the shelf, etc.).
  • Finally, our administrative part has a report (ASP.NET) attached to AlertId that displays all pending messages and their status.
+1
source

You can have a background process of importing records of records about the state of recordings into the database as the sections of the task are completed, and the web application can simply try the database at random intervals and update the progress bar or otherwise disable the tasks as they are completed, whatever was in the user interface.

0
source

Source: https://habr.com/ru/post/1346213/


All Articles