You have to be very careful on forming the message and sending it to the queue as well as win-service configuration has to be set properly.
Check the post here : No enabled application monitor is on behalf of queue XYZ
题
I need to get SSB External Activation to launch an exe off of a db trigger. With the bits of information available on the net I have managed to get almost everything working perfectly. I can send messages to the queue and I can read messages off the queue using a C# app that continuously polls the db. But I need the External Activator to actually launch my exe. This is for work and I'm stuck so any help is greatly appreciated!
External Activator Log file: Here
External Activator Config file: Here
Status' of Queues (picture): Here
Thanks!
Edit: SQL Code:
ALTER DATABASE AdventureWorks2012 SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;
CREATE MESSAGE TYPE [requestMessageType] VALIDATION = WELL_FORMED_XML
CREATE MESSAGE TYPE [responseMessageType] VALIDATION = WELL_FORMED_XML
CREATE CONTRACT [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] )
CREATE EVENT NOTIFICATION EventNotificationTargetQueue ON QUEUE TargetQueue FOR QUEUE_ACTIVATION TO SERVICE 'ExternalActivatorService', 'current database';
CREATE TABLE [Order] ( ID int identity(1000,1) NOT NULL, Amount MONEY NOT NULL )
-- Trigger will add a message into a ImportQueue Create TRIGGER OnOrderInserted ON [Order] FOR INSERT AS BEGIN BEGIN TRANSACTION; 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
alter authorization on database::AdventureWorks2012 to [sa];
ALTER QUEUE InitiatorQueue WITH ACTIVATION ( PROCEDURE_NAME = ProcessResponseMessages, STATUS = ON, MAX_QUEUE_READERS = 1, EXECUTE AS OWNER )
解决方案
You have to be very careful on forming the message and sending it to the queue as well as win-service configuration has to be set properly.
Check the post here : No enabled application monitor is on behalf of queue XYZ