cancel
Showing results for 
Search instead for 
Did you mean: 

Import Document using Multi Thread

Ari_Alves_Ribei
Champ in-the-making
Champ in-the-making

Hello Team,

I'm developing an integration of a proprietary application images for importing documents.


I am using VS Studio 2008 and C # in a Windows Service project and OnBase 12 with Unity API.


The proprietary application has concept that all documents store are int the batch, and my integration service need import all documents of batch.


I would like to know if, after connecting the Unity API,  can we start multiple threads for each import batch of documentspreserving a limit of concurrent threads but we are using the same section connecting.

Thanks

Ari Ribeiro


2 REPLIES 2

Nathaniel_Jacob
Champ in-the-making
Champ in-the-making

Hi Ari,

We do something similar, but use a connection pool so that each thread basically has its own license.  The pool members are reassigned based on availability and not committed to a particular thread. We've had no problem passing them between threads so long as we keep a semaphore that ensures only one thread can use one connection at any given time.

Brian_Koning
Star Contributor
Star Contributor

Hello Ari,

I first want to apologize for the delay in having an official answer to your question. At this point, I am sure my answer is for future reference for others and as validation of the solution you might have written.

The most important thing to remember about using the Hyland.Unity.Application class in a multi-threaded environment is that it does not support concurrency at all. You must ensure that only one thread is using an Application instance at any given time. Using a semaphore along with a single Application instance as Nate suggested above is one way to solve the problem. Depending on how many threads you are executing concurrently, another way could be to use multiple Application instances, one dedicated per thread.

There are many different solutions to the problem you are suggesting and the right solution depends on what you are trying to get out of your design. A few common pitfalls to watch out for in a multi-threaded environment are the above mentioned Application concurrency problems and running afoul of the Session Pooling Licensing agreements. More information about the latter subject can be found in the Hyalnd SDK on the [ Home / API Basics / Licensing the OnBase APIs / Session Management ] page.