Hi everyone,
I'm wondering what is the best way to use a SqlConnection object inside a QueueClient::OnMessage callback when the MaxConcurrencyCalls property form OnMessageOption is bigger than 1?
My concerns are about optimizing Open() / Close() calls.
If I well understand how OnMessage is working (guessed on dicussions read on Internet) for each message, a new Thread is created and the callback provided to OnMessage is called inside that thread. Meaning that I cannot create a "global" SqlConnection and use it inside my callback.
Is OnMessage really working like that? Or is it always the same "threads" which are used from a OnMessage callback call to another (like, X threads pre-created then used and used again)?
If threads are always different, what the best way to optimize database acces inside the callback (I would like to avoid open / close the connection for all messages)?
Maybe OnMessage is not the right way to proceed?
Many thanks for your help,