Can anyone explain this concept to me:
In Service Broker (SQL Server) a queue can be configured with an "activation" procedure. This is a procedure that will execute when message arrive in the queue.
Guidance on how to write such a procedure generally involves using the WAITFOR RECEIVE statement to get a message from the queue, and to wait if there are no messages.
So, the question is -- why are we waiting for the message to arrive in the queue inside the procedure that is executed when messages arrive in the queue?
Or, another way of putting the same question -- how can the arrival of the message trigger a procedure to wait for the arrival of a message?
Thanks for any perspective on this. I just don't understand how this is really working.