Click here to Skip to main content
15,911,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to keep track of a queue of string messages that I receive from a third party device. I need that queue to be available again after the application is restarted. The enqueuing and dequeuing of items needs to happen pretty quickly, so performance is an issue.

Any advice of what I should be using?

My initial plan was to simulate a queue using text files - creating a file each time an item is added to the queue, and deleting a file when an item is dequeued. This however seems clunky, and I can't help but feel that there has to be a better way of doing this.

What I have tried:

I originally just started using the System.Collections.Queue object to store the messages, but I need a way for the queue to be available if the application is restarted.
Posted
Updated 8-Oct-17 21:51pm

1 solution

Use a database: INSERT when they arrive, DELETE when they are processed. If you add a timestamp column, you can easily retrieve the oldest item - which is the head of the queue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900