How do I create make a series of Queue's accessible to multiple classes?
1. One part of the application has data fed in;
2. The application stores this information into a Queue;
3. This Queue just keeps on building with new data - lets say *a lot* of data is being added every second.
4. (Stuck on this) I have classes with code ready to manipulate this data and send it to a DB (store it) and a management application (do-something) via SqlConnection and TCP respectively.
Several threads will be "active" using these classes, each using `aString = aQueue.Dequeue()`, and then manipulating aString before sending it off over the wire. Taking the data from the Queue obviously stops other threads getting it.
Multiple threads will be used to try and ensure the queue is always as empty as possible. Going across a network will take at least a few MS, which obviously is not going to be burning processing time... that can instead be used to manipulate the next item.
For this method to work, all threads need to use a centralised "store" - the Queue(s) - and strip off one piece of work at a time (thus Dequeue).
So what you will have happening is data being added to queues from a.disperate.source, and then several threads looking at this queue to pull the information apart… continuously.
So.. The question is: **How** do I make it so these Queues can be accessed by the thread adding data in, and also the threads taking data out?
Any input gratefully received..!
Error when trying public static:
cannot declare instance members in a static class
Error when using public:
An object reference is required for the nonstatic field, method, or property
( Can an instance of the class be made, and then accessed by everything else… data adder class + handler classes and the threaded instances of them? If so... how?)