To answer your questions:
Can I listen to SQL Server Service
Broker queues from .NET applications
running on a different machine?
Yes.
If so, should I do it?
If not, what would you recommend?
You might consider using SqlDependency
. It uses Service Broker behind the scenes, but not explicitly.
You can register a SqlDependency
object with a SELECT
query or a stored procedure. If another command changes the data that was returned from the query, then an event will fire. You can register an event handler, and run whatever code you like at that time. Or, you can use SqlCacheDependency
, which will just remove the associated object from the Cache when the event fires.
You can also use Service Broker directly. However, in that case you will need to send and receive your own messages, as with MSMQ.
In load-balanced environments, SqlDependency
is good for cases where code needs to run on every web server (such as flushing the cache). Service Broker messages are better for code than should only run once -- such as sending an email.
In case it helps, I cover both systems in detail with examples in my book (Ultra-Fast ASP.NET).