我需要获取SSB外部激活才能启动数据库触发器的exe。随着网络上可用的信息,我已经成功地完成了几乎所有工作。我可以将消息发送到队列,我可以使用连续轮询数据库的C#应用程序从队列中读取消息。但是我需要External Activator来实际启动我的exe。这是为了工作,我被困住,所以任何帮助都非常感谢!
外部激活器日志文件:Here
外部激活器配置文件:Here
队列的状态'(图片):Here
谢谢!
编辑:SQL代码:
ALTER DATABASE AdventureWorks2012使用ROLLBACK IMMEDIATE设置ENABLE_BROKER;
创建消息类型[requestMessageType] VALIDATION = WELL_FORMED_XML
创建消息类型[responseMessageType] VALIDATION = WELL_FORMED_XML
创建合约[smtContract] ( [requestMessageType] SENT BY INITIATOR, [responseMessageType] SENT BY TARGET )
CREATE QUEUE InitiatorQueue WITH STATUS = ON
CREATE QUEUE TargetQueue WITH STATUS = ON
CREATE SERVICE InitiatorService ON QUEUE InitiatorQueue ( [smtContract] )
CREATE SERVICE TargetService ON QUEUE TargetQueue ( [smtContract] )
CREATE QUEUE ExternalActivatorQueue WITH STATUS = ON
CREATE SERVICE ExternalActivatorService ON QUEUE ExternalActivatorQueue ( [http://schemas.microsoft.com/SQL/Notifications/PostEventNotification] )
创建事件通知EventNotificationTargetQueue ON QUEUE TargetQueue FOR QUEUE_ACTIVATION 服务'ExternalActivatorService','当前数据库';
创建表[订单] ( ID int identity(1000,1)NOT NULL, 金额不是NULL )
- 触发器会将消息添加到ImportQueue中 创建TRIGGER OnOrderInserted ON [Order] FOR INSERT 如 开始 开始交易; DECLARE @ch UNIQUEIDENTIFIER DECLARE @messageBody NVARCHAR(MAX);
BEGIN DIALOG CONVERSATION @ch
FROM SERVICE [InitiatorService]
TO SERVICE 'TargetService'
ON CONTRACT [smtContract]
WITH ENCRYPTION = OFF;
-- Construct the request message
SET @messageBody = (SELECT ID, Amount FROM [Order] FOR XML AUTO, ELEMENTS);
-- Send the message to the TargetService
;SEND ON CONVERSATION @ch
MESSAGE TYPE [requestMessageType] (@messageBody);
COMMIT;
END GO
将对database :: AdventureWorks2012的授权更改为[sa];
ALTER QUEUE InitiatorQueue 激活 ( PROCEDURE_NAME = ProcessResponseMessages, STATUS = ON, MAX_QUEUE_READERS = 1, 执行作为所有者 )
答案 0 :(得分:1)
您必须非常小心地形成消息并将其发送到队列,并且必须正确设置win-service配置。
点击此处的帖子:No enabled application monitor is on behalf of queue XYZ