June 18, 2014 at 2:49 pm
Hi,
I having some issues getting Service Broker to work with an Internal Activation Procedure.
I have the following code.
USE [CabinetDoor]
GO
--ALTER DATABASE CabinetDoor SET ENABLE_BROKER;
IF EXISTS (SELECT * FROM sys.services WHERE name = N'WFProductionInProcess_Target')
BEGIN
DROP SERVICE
[WFProductionInProcess_Target];
END
IF EXISTS (SELECT * FROM sys.services WHERE name = N'WFProductionSchedule_Initiator')
BEGIN
DROP SERVICE
[WFProductionSchedule_Initiator];
END
IF EXISTS (SELECT * FROM sys.service_queues WHERE name = N'WFPIPScheduleInitiatorQueue')
BEGIN
DROP QUEUE WFPIPScheduleInitiatorQueue;
END
IF EXISTS (SELECT * FROM sys.service_queues WHERE name = N'WFPIPScheduleTargetQueue')
BEGIN
DROP QUEUE WFPIPScheduleTargetQueue;
END
IF EXISTS (SELECT * FROM sys.service_contracts WHERE name = N'WFPIPContract')
BEGIN
DROP CONTRACT
[WFPIPContract];
END
IF EXISTS (SELECT * FROM sys.service_message_types WHERE name = N'WFPIPRequestMessage')
BEGIN
DROP MESSAGE TYPE
[WFPIPRequestMessage];
END
IF EXISTS (SELECT * FROM sys.service_message_types WHERE name = N'WFPIPReplyMessage')
BEGIN
DROP MESSAGE TYPE
[WFPIPReplyMessage];
END
GO
--Create Message Type
CREATE MESSAGE TYPE [WFPIPRequestMessage]
VALIDATION = WELL_FORMED_XML;
CREATE MESSAGE TYPE [WFPIPReplyMessage]
VALIDATION = WELL_FORMED_XML;
GO
--Create Contract
CREATE CONTRACT [WFPIPContract]
(
[WFPIPRequestMessage] SENT BY INITIATOR
, [WFPIPReplyMessage] SENT BY TARGET
);
GO
--Create Queue
CREATE QUEUE WFPIPScheduleTargetQueue
WITH STATUS=ON, ACTIVATION
(STATUS=ON, MAX_QUEUE_READERS=5,
PROCEDURE_NAME = BrokerTargetActiveProc, EXECUTE AS SELF),
POISON_MESSAGE_HANDLING (STATUS=OFF);
CREATE SERVICE [WFProductionInProcess_Target]
ON QUEUE WFPIPScheduleTargetQueue (WFPIPContract);
CREATE QUEUE WFPIPScheduleInitiatorQueue
--Create WFProductionSchedule_Initiator
CREATE SERVICE WFProductionSchedule_Initiator
ON QUEUE WFPIPScheduleInitiatorQueue;
June 18, 2014 at 2:57 pm
This forum will not allow me to post all my code, so I have attach it as files.
I call the code in Start Conversation from a desktop application, using integrated security.
I have implemented one other service broker project, and I remember doing some security changes to allow the queue to receive and send and such. Is this all I am missing?
I have followed several tutorials without any luck.
Thanks
Gary
June 21, 2014 at 11:02 am
There are many reasons why Service Broker can fail.
For analyzing this I recommend to disable the activation procedure. This way you can see if the data is at least reaching the target queue.
If so, call the activation procedure manually and have a look what it's doing.
Have a look at the command line utility "ssbdiagnose" (http://msdn.microsoft.com/en-us/library/bb934450.aspx)
It sends a test package between defined services. It helped me a lot getting Service Broker run.
June 21, 2014 at 11:16 pm
Hi,
Thanks for replying.
I ended up following another tutorial, that defined all stored procedure parts gradually. I think it was Remus somebody, basically testing without the activation turned on.
Thanks
Gary
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply