Solved

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

Posted on 2014-01-07
2
633 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

770 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