Solved

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

Posted on 2014-01-07
2
619 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
Comment Utility
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
Comment Utility
Along with this, you can have a processed_flag. Also, this can be achieved using SQL Express/MS Access.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

744 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

18 Experts available now in Live!

Get 1:1 Help Now