Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save occdevcamp/d4a0174b8a82d3d5f76e to your computer and use it in GitHub Desktop.
Save occdevcamp/d4a0174b8a82d3d5f76e to your computer and use it in GitHub Desktop.
This will again put some messages on the queue. Once it has completed (quickly) the processing will have been started and can be monitored by re-running the final Select * From dbo.T_QueueProcessingResult With (NoLock) statement. Every ~5s, a new row should appear (5 in total).
Use ServiceBrokerDemo
GO
Set NoCount On
-- Clear out any previous results of processing the queue's messages.
Delete dbo.T_QueueProcessingResult
RaisError ('Adding messages to the queue ...', 0, 1) With NoWait
Exec dbo.Proc_Queue_Send_Message
@Message = '<row StatusID="2" Status="Modified"/><row StatusID="1" Status="New"/><row StatusID="3" Status="Unmodified"/>',
@FromService = 'Service_Demo',
@ToService = 'Service_Demo',
@OnContract = 'Contract_Demo'
RaisError ('Adding more messages ...', 0, 1) With NoWait
Exec dbo.Proc_Queue_Send_Message
@Message = '<row StatusID="27" Status="Anonymised"/>',
@FromService = 'Service_Demo',
@ToService = 'Service_Demo',
@OnContract = 'Contract_Demo'
RaisError ('Adding another message to the queue ...', 0, 1) With NoWait
Exec dbo.Proc_Queue_Send_Message
@Message = '<row StatusID="999" Status="Defective"/>',
@FromService = 'Service_Demo',
@ToService = 'Service_Demo',
@OnContract = 'Contract_Demo'
-- Then have a look at the results of the processing.
-- Run this final statement repeatedly - it will take ~25s before all 5 rows are processed.
Select * From dbo.T_QueueProcessingResult With (NoLock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment