@@ -19,3 +19,7 @@ http://www.davewentzel.com/content/service-broker-monitoring-routine. For a noo
- there is a section to place custom TRACER TOKEN code. You need to code this. This would be similar to replication's tracer token feature. Essentially you code a "test" message that flows through your workflow and you monitor it to see if it runs to completion and if not where it failed.
- has an option for STALLED MESSAGE CLEANOUT. This removes old conversations that you deem as not needed that are not in the CLOSED state. This is useful in dev envs where you changed some activator code and the queues failed and there are a bunch of useless messages. Probably not good to run this on a production db.
This is a "pattern" I use for each new SSB "module" that I need to deploy. It helps ensure everything is reliably and consistently configured and easy to debug.
IF@OptionNOTIN('SETUP','TEARDOWN','TEARDOWN FORCE OVERRIDE','CHECK','BROKER HELP','DISABLE ALL QUEUES','STALLED MESSAGE CLEANOUT')
IF@OptionNOTIN('SETUP','TEARDOWN','TEARDOWN FORCE OVERRIDE','DISABLE ALL QUEUES','STALLED MESSAGE CLEANOUT')
BEGIN
PRINT'Valid @Option: SETUP,TEARDOWN,TEARDOWN FORCE OVERRIDE,CHECK,BROKER HELP,DISABLE ALL QUEUES'
PRINT' SETUP = setup/upgrade and run the reasonability checks. '
PRINT' TEARDOWN = remove all traces of SHELL queueing, but only if the Qs are clear. Leaves the table triggers. '
PRINT' TEARDOWN FORCE OVERRIDE = remove all traces of SHELL queueing, regardless.'
PRINT' CHECK = run only the reasonability checks. '
PRINT' BROKER HELP = show me the state of Service Broker and its various Qs, Services, etc'
PRINT' DISABLE ALL QUEUES = disables all activated Qs and tickling.'
PRINT' STALLED MESSAGE CLEANOUT = cleans out Service Broker messages that are in-flight but damaged. This should only be run if you know what you are doing, after you fix a broken Q'
RAISERROR('You picked an invalid @Option.',16,1)
@@ -143,7 +141,9 @@ END; --TEARDOWN
IF@OptionIN('SETUP')
BEGIN
BEGIN--SHELL Setup Section
--add Message Types here, if needed
--add contracts here, if needed
--is the SHELL Q and service installed and running?