Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

809 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