TMSEventNotification - new Connection
Posted: Sun 13 Sep 2015 09:49
How do I prevent the creation of a new connection when using the TMSChangeNotification?
Best Mathias
Best Mathias
Discussion forums for open issues and questions concerning database tools, data access components and developer tools from Devart
https://forums.devart.com/
Code: Select all
WHILE (1 = 1)
BEGIN
DECLARE @messageBody VARBINARY(MAX);
DECLARE @messageTypeName NVARCHAR(256);
WAITFOR (
RECEIVE TOP(1) @messageTypeName = message_type_name, @messageBody = message_body
FROM Queue_Audit_LogOut
), TIMEOUT 500
IF @@ROWCOUNT = 0
BEGIN
BREAK;
END
IF (@messageTypeName = 'http://schemas.microsoft.com/SQL/Notifications/EventNotification')
BEGIN
DECLARE @xmldata xml
DECLARE @LoginName nvarchar(128)
DECLARE @ApplicationName nvarchar(128)
DECLARE @SPID int
DECLARE @SID int
SET @xmldata = CAST(@messageBody AS XML);
SET @LoginName = @xmldata.value('(/EVENT_INSTANCE/LoginName)[1]', 'nvarchar(128)');
SET @ApplicationName = @xmldata.value('(/EVENT_INSTANCE/ApplicationName)[1]', 'nvarchar(128)');
SET @SPID = @xmldata.value('(/EVENT_INSTANCE/SPID)[1]', 'int');
if upper(@ApplicationName)='[my Application_Name]'
BEGIN
-- clear any data
END
if upper(@ApplicationName)='[my Application_TMSNOTIFICATION]'
BEGIN
-- DROP SERVICE SDAC___ if exists
-- DROP QUEUE SDAC___ if exists
END
...