Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there a way to get to know how many external tasks (console applications) is reading queue?

I am using Service Broker external activator.

What i want is something similar to information i get from sys.dm_broker_activated_tasks, just for external queue readers.

share|improve this question
1  
this belongs on dba –  Daniel A. White Oct 30 '12 at 14:55
    
How would it know? There's no requirement that these external tasks maintain a connection to the server at all times, nor that they notify the server when they shut down, nor even that the process that is launched isn't just a bootstrap process that launches the real external task that reads from the queue. –  Damien_The_Unbeliever Oct 30 '12 at 14:57
    
just like internal activated procedures- if there is connection AND transaction that reads data from queue, then 1, else 0.. (and it is possible to see how many external tasks is waiting for message to arrive to queue) @Damien_The_Unbeliever –  Jānis Oct 30 '12 at 15:01
add comment

migrated from stackoverflow.com Oct 30 '12 at 16:59

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 2 down vote accepted

Sort of. You can see though sys.dm_exec_requests executing a RECEIVE statement (including a WAITFOR RECEIVE). By simply peeking into the the currently executing text sys.dm_exec_sql_text(sql_handle) between the statement_start_offset and statement_end_offset you can see if the statement is RECEIVE or not (with some parsing...). Figuring out if an active transaction has issued a RECEIVE and is now processing returned messages is more complicated.

Is somehow of an unusual request, why do you need to know?

share|improve this answer
    
Messages are processed in console app, it calls web services, sometimes it can slow down (it happens while receive transaction is open). Was thinking of the easy way to monitor what is happening. –  Jānis Oct 31 '12 at 7:01
    
Instrument the console app, add application performance counters to trace duration and count of operations. –  Remus Rusanu Oct 31 '12 at 7:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.