Okay. I have a question about the method that I was going to use to process items in a queue in order.
Let's say I have a queue, with a bunch of records, doesn't matt of what. The main point is that each queue, let's say, belongs to a certain account, so let's say we have an AccountID with each queue item.
It may look like this:
Account ID, Record 543, 1 123, 2 543, 3 543, 4
Okay, now, the main criteria here is that I don't want to process record 4 for account id 543 before record 1 is processed for account id 543.
Basically, to keep it simple, let's just say I'm grabbing all the records and then throwing them in a thread pool.
Here is how I was going to do the processing:
1) The first method I was going to do is when I'm looping through the records and throwing them in the thread pool, is on each iteration only throw in unique account id's. So, on the first iterationof the above data, I would only throw records 1 and 2 in.
The idea is that if I grab 1000 records at a time, hopefully this will help prevent locking with the second method I use.
2). The second method I use is when I go to process the record, I was going to use SyncLock thread locking method to grab an object for that specific account id. So, when the the next thread comes to process that account id, it would wait until that object
What do you guys think? Or, what is a better method?