Jaa


WAITFOR (RECEIVE ...) does not poll!

A lot of people have been concerned about using the WAITFOR (RECEIVE ...) statement for receiving Service Broker messages from a queue. Several believe that this would poll the queue continuously until messages become available in the queue either by another transaction enqueueing messages or a lock that was previous held being released. The polling wary have asked for an alternative notification based mechanism to fix this. For all you guys.. relax! WAITFOR (RECEIVE ...) does not poll. It does not consume any processor cycles on the server side or the client side (assuming that ADO.NET indeed uses IO completion ports).  The only thing you are possible using up is a thread that blocks until a result set is available. If you do not want to sacrifice your thread, go ahead and use BeginExecuteReader while posting your WAITFOR(RECEIVE ...) statement from ADO.NET.