all groups > sql server programming > october 2007 >
You're in the

sql server programming

group:

How to execute a service broker RECEIVE and block until there is a result?


How to execute a service broker RECEIVE and block until there is a result? stevehunter_1 NO[at]SPAM hotmail.com
10/29/2007 8:34:38 PM
sql server programming: I am porting an application from MSMQ to Service Broker. The nice
thing about MSMQ is you can call a function that blocks until
something comes into the queue. So the application receives the
message instantly.

How do you achieve this in service broker? When I do a RECEIVE AS
MESSAGE FROM (xyz) it returns zero rows or a result. I would like it
to sit there indefinitely or for x seconds and wait for a result
before returning.

please advise
Re: How to execute a service broker RECEIVE and block until there is a result? Tibor Karaszi
10/30/2007 8:35:10 AM
You can use the WAITFOR command for that. WAITFOR has been expanded in 2005 to wait for a message to
arrive.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


[quoted text, click to view]

AddThis Social Bookmark Button