I am using service broker to make async calls to a stored procedure. All my objects are within a single database.
I created a RequestMessage, ReplyMessage, Contract, InitiatorQueue, InitiatorService, TargetQueue and TargetService.
I have a stored procedure ProcessTargetQueue attached to a TargetQueue. It calls another stored procedure ExtractData. The ExtractData run remote queries using OPENQUERY and fetch data from remote SQL servers. I created the queue using the below code
CREATE QUEUE TargetQueue
WITH STATUS = ON,
STATUS = ON,
PROCEDURE_NAME = <DBName>.dbo.ProcessTargetQueue,
MAX_QUEUE_READERS = 25,
EXECUTE AS OWNER )
I populate the queue using the procedure LoadAndProcessQueue. Typically 10-20 message would be sent during an execution.Whenever a message arrives in TargetQueue the procedure ProcessTargetQueue executed.
But it throws an error message :
Msg 65535, Level 16, State 1, Line 0
SQL Server Network Interfaces: Error getting enabled protocols list from registry [xFFFFFFFF].
The account using which I run the procedure LoadAndProcessQueue is same as the one used for creating all the service broker related objects.
When the stored procedures are run individually there is no error.
What could be going wrong here? When I ran multiple times the procedure LoadAndProcessQueue I found that during one or two attempts the ProcessTargetQueue executed successfully ! I am using SQL 2008 R2.
Any Help Appreciated.