Solved

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

Posted on 2014-01-07
2
672 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
[X]
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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

705 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