Answer the question
In order to leave comments, you need to log in
How to implement queue processing service in C# + EF 6?
Good day!
Technologies:
ASP.NET MVC 5, Entity Framework 6, SQL Server 2008/MySQL
Task:
There is a web application (ASP.NET MVC) in which the user uploads files (upload) with a certain structure (one file at a time). The files contain a lot of data (medium-structured). After uploading the file, it is necessary to "scatter" all the data from the uploaded file into about 15 tables using certain business rules.
Idea:
Since working out business rules and "scattering" data from one file can take a lot of time, it was decided to organize a certain queue "for unpacking" (by implementing the queue using the QueueTable table described below), and process the queue itself by a separate service (or windows service, or a simple console application) on the server.
It turns out after upload'a from ASP.NET MVC, the data about the file is stored in a table like this with the status InProgress (1):
CREATE TABLE QueueTable
(
Id int,
FilePath varchar(255),
StatusId int
);
Answer the question
In order to leave comments, you need to log in
there is an application with approximately the same architecture, only the “file” itself, in my case, I put it in the same place in the database so that the service does not depend on any folder. There are no questions about reliability and rate of fire at all, everything works very quickly. Parallel processing was done in the following way:
Thus, it turns out that the threads "select" a task for themselves, process it and update the status, and so on in a circle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question