Solved

C# Console App - Producer / Consumer using database as a queue.

Posted on 2014-01-07
2
624 Views
Last Modified: 2014-01-08
Hi,

I'm looking at creating two C# console applications. The first console app will produce text records (possibly multiple records concurrently) and write them to a database. The second app will take each record in the database (queue) and consume them in order that they were created deleting each record as it is processed. The two applications will run concurrently on the same machine.

Is MS SQL CE a good fit for holding this 'record queue'?

How can I safely produce and consume the records without running to any conflicts?

Thanks for any input
0
Comment
Question by:mhdi
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
ID: 39764505
Unless you have very limited resources on the station, I would go for SQL Server Express instead of CE. It's also free but offers more possibilities should you ever need to do more with the application.

As for a way to safely produce and consume the records, just make sure that the table has a an Identity field. The system automatically assign a value to that field, and by default, increase its value by one everytime it receives a new row of data.

You are thus assured to have a unique value for each row, and simply have to follow the sequence to read back the rows in the same order that they were inserted.
0
 
LVL 13

Assisted Solution

by:sameer2010
sameer2010 earned 250 total points
ID: 39764822
Along with this, you can have a processed_flag. Also, this can be achieved using SQL Express/MS Access.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now