Friday, February 24, 2012

Can activation SP wake up a thread?

Newbie question, but is there a way for me to set up a thread in my c# code so as it sleeps until it gets woken up by an event fired by an activation SP?

As in queue sits idle, thread sleeps.
Queue receives a message, activation SP gets fired, activation SP raises an event which gets caught by event handler in code, which wakes up thread to do processing?

The activated procedure can be C# code (an assembly in the database). Once activated, your CLR code would be invoked in a thread inside SQL Server and can issue a RECEIVE (using SqlCommand) to retrive the messages from the queue.

If you want your C# code to be in an external application (an .EXE) then you should use external activation instead of internal activation. Have a look at the External Activator sample at http://www.codeplex.com/SQLSrvSrvcBrkr/

No comments:

Post a Comment