Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Threadpooling, async writing, batch processing.

$
0
0
Hello everyone, I need a little help as I have been away from the VB.net programming world for a few years.

Project Scope:
When an email arrives in outlook from a specific email address, save any attachments to a specific directory. Have a windows service watch for new files being created in that directory and search for PDF documents. Each email that comes in will be a separate process and could contain multiple PDF documents with data to be extracted, so batch each email into separate processes. for instance, create a sub directory and move all the pdf's to that folder upon creation/detection. When the PDF document has been found, extract any PDF form data from it and save it as XML. Then extract specific information from the batch process and export it to a text file so I can call an oracle procedure and have the procedure take it from there. The processing time is very crucial so we can avoid any emails that arrive at the same time.


My issue is basically accounting for two emails coming in at a time. I am using thread-pooling to handle the creation of new threads per batch process. Before I found out each email would have multiple PDF's with data to extract, I was just running new threads per PDF created. Now I have to find a way to batch these processes based on the arrival of emails. When an email arrives, we have a plugin running in Outlook that will extract any attachments in the email and store it to a folder. But each PDF is created synchronously so that causes my application to trigger upon each file creation.

Does anyone have any ideas on how I can work around this issue where the files are being created synchronously and triggering my application upon each file creation? I would like it to be triggered AFTER file creations have stopped. Time is very crucial (in my opinion it's not as crucial as others might think) THEN I can copy all those files to a sub-directory and extract any PDF data.

I was thinking of using the creation time of the files extracted from the email, to create batch processes, because those all seem to match but it only provides HH:MM. This means anything created after the first email will be included into the first emails batch process.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>