I would appreciate any links or discussion on this. I have found a number of similar questions but no definitive answer that it can be done. There is a .NET interface to ActiveMQ so maybe the answer is a C# CLR procedure to get this done.
Thanks
Tom
I would appreciate any links or discussion on this. I have found a number of similar questions but no definitive answer that it can be done. There is a .NET interface to ActiveMQ so maybe the answer is a C# CLR procedure to get this done.
Thanks
Tom
I'm calling stored procedure asynch with timer:
DECLARE @DialogHandle UNIQUEIDENTIFIER, @RequestMessage NVARCHAR(255);
BEGIN dialog CONVERSATION @DialogHandle FROM SERVICE [SAStockIncreaseService] TO SERVICE N'SAStockIncreaseService', 'current database' WITH ENCRYPTION = OFF;
BEGIN CONVERSATION TIMER(@DialogHandle) TIMEOUT = 10;
It works. The procedure defined within 'SAStockIncreaseService' is called after 10 seconds.
There is message in SAStockIncrease queue:
RECEIVE TOP (1) @Handle = conversation_handle, @message=message_body FROM dbo.SAStockIncrease;
This message is empty. Now I would like to add something to this message.
As i understand from documentation, this message is always empty when using timer. It is not possible to put something inside?
If i would like to send some message inside call of my procedure, i must add this 2 lines:
SET @RequestMessage = N'<Request><SA>58</SA></Request>';
SEND ON CONVERSATION @DialogHandle(@RequestMessage);
This way I would have 2 messages inside dbo.SAStockIncrease queue, but they will have the same group and conversation handle, so I can new that they belongs together.
It looks stupid to me, why not put message into timer call and have only one record(message) in my conversation, but that is how it is, if I understand correctly.
So, when I execute this:
RECEIVE TOP (1) @Handle = conversation_handle, @message=message_body FROM dbo.SAStockIncrease;
I will always get the timer message first. Than I should check if there is another message with select statement:
SELECT @message=CAST(message_body) WHERE conversation_handle=@handle
But what if some other user executes RECEIEVE TOP(1).. at the same time and clear my message from the queue?
What is the right procedure to read all messages with the same handle at the same time?
I guess it is obvious what I would like to do - so, what is the right way?
Thanks,
Simon
Hi all,
I have a simple piece of code that sends a single message to a service, which is then "connected" to a queue, and this queue has an associated stored procedure.
A code example:
SET @ConversationHandle = NEWID() BEGIN DIALOG @ConversationHandle FROM SERVICE [InitiatorService] TO SERVICE ReceiverService WITH ENCRYPTION = OFF, LIFETIME = 3600; SEND ON CONVERSATION @ConversationHandle MESSAGE TYPE [DEFAULT] ('921834729384'); END CONVERSATION @ConversationHandle
So what this code does is sending the number 921834729384 into the service.
I need to execute something like this for several distinct ID's, and I don't want to send them all at a time. Currently I'm running this inside a cursor, and I'd like to find a way of sending all ID's in parallel into the queue (respecting a predefined order) but avoiding something like a cursor or a cycle.
Is there any workaround?
Thank you.
I am trying setup SQL dependency on local machine using SQL express, and i have following questions
1>Does SQL dependency works with SQLExpress or do i need full SQL Server?
2>On local machine, The dbo user is running under my login account. My login account is "sysadmin" in ./SQLExpress. Im assuming that means it has all the permissions. Do i still need to set all other permissions to run SQLDependency?
3>When i Start dependency by passing queue name, i get the following exception
When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.
When I don’t pass queue name, I don’t get exception but .net application doesn’t get call back either when SQL table is updated.
(Note that eventually i'm going to call Intialization() method at application start)
Here is my complete code
public class SqlHelper { public void Initialization() { // Create a dependency connection. SqlDependency.Start(GetConnectionString(), "SendStatusChangeMessages"); CanRequestNotifications(); } public void SomeMethod() { // Assume connection is an open SqlConnection. using (SqlConnection con = new SqlConnection(GetConnectionString())) { con.Open(); // Create a new SqlCommand object. using (SqlCommand command = new SqlCommand( "SELECT BatchStatus from MyTable WHERE ID = 1", con)) { // Create a dependency and associate it with the SqlCommand. SqlDependency dependency = new SqlDependency(command); // Maintain the refence in a class member. // Subscribe to the SqlDependency event. dependency.OnChange += new OnChangeEventHandler(OnDependencyChange); Initialization(); // Execute the command. using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { var message = reader.GetString(0); } } } } } // Handler method public void OnDependencyChange(object sender, SqlNotificationEventArgs e) { var info = e.Info; } public void Termination() { // Release the dependency. SqlDependency.Stop(GetConnectionString(), "SendStatusChangeMessages"); } private string GetConnectionString() { return System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString; } private bool CanRequestNotifications() { SqlClientPermission permission = new SqlClientPermission( PermissionState.Unrestricted); try { permission.Demand(); return true; } catch (System.Exception) { return false; } } }
Hello
I did some prototype dev using a new db I created on our dev SQL server instance and OnChange events only when the underlying data was changed. I tried the same thing with another database on the same server which is a replica of our live database. With this it just kept firing the event regardless of what activity there was in the table. I even created a totally empty table and used that for the query and it still fired on an empty table.
Is there anything obvious that I need to do to this database to stop this? I'm pretty sure my c#is ok just confused by this
Thanks,
Dave.
== I asked this question directly to Remus and wanted to share the response to all of those people using this forum ==
We recently moved our database server from SQL Server 2000 to SQL Server 2005. All applications on our intranet development server stay the same [VS.NET 2003], but recently resources in our Dev DB server ran out of space. While doing a thorough investigation, I noticed ERRORLOG file was occupying about 35 Gig of HDD space. I immediately checked SQL Server error log and noticed an entry which says –
===========================================================================================
Date 7/7/2006 4:45:37 PM
Log SQL Server (Current - 7/7/2006 4:45:00 PM)
Source spid77s
Message
The activated proc [dbo].[SqlQueryNotificationStoredProcedure-5eaf8465-d0cb-4be7-93b6-44bb979dd41c] running on queue BW_Content.dbo.SqlQueryNotificationService-5eaf8465-d0cb-4be7-93b6-44bb979dd41c output the following: 'Could not obtain information about Windows NT group/user 'BWCINC\HoffK', error code 0x534.'
===========================================================================================
What is this SqlQueryNotificationService in my database? Is it a SQL Server 2005 thing? Why the same kind of stored procedure does not exist in other databases, but BW_Content? This error is getting repeated most probably every second and is filling up our server.
I believe our corporate IT people removed our domain accounts from BWCINC domain to BWCORP domain and probably some application which is using BWCINC\HoffK credential is getting errored out. I tried to locate this application and was not successful.
Is there anyway that I can stop this ERRORLOG from growing? How can I delete these log entries so that I can make space on our Hard Drive? Is there an easy way in SQL Server 2005 to locate which application is creating this error?
Response from Remus:
select
name,suser_sname(owner_sid)fromsys.databasesHi,
We use query notification to receive notifications from SQL Server 2008 R2 to BizTalk 2010. Sometimes the notification fails and BTS doesn't receive any notification. In SQL Server Log we get this message "Cannot find the remote service-SqlQueryNotificationService-......"
because it does not exist. But after sometime without we doing anything the query notification starts working again fine when a new record insert into the table.
1. I would like to know what would cause this error to happen. how to fix this from happening again.
2. When query notification fails there is at least one record in the table which is not yet processed by BTS. Sometimes query notification resumes working after a new record is insert into the same table. Is there way to explicitly push the notification to
BTS from SQL Server.
Thanks,
Vijay.
HI
I have an example ( see below ).
I expect to have all messages sent using this code to have the same group id but they are all different. what I am doing wrong?
Leonid.
DECLARE
@conversationHandle uniqueidentifierDECLARE @usergroup uniqueidentifier
select @usergroup = uid from bvuser where userid = 1
select
@usergroupBegin
TransactionBEGIN
DIALOG @conversationHandleFROMSERVICE [BvMainResponseService]TOSERVICE'BvMainService'ONCONTRACT [BvMainContract]WITH RELATED_CONVERSATION_GROUP = @usergroup;-- Send a message on the dialog
SEND
ONCONVERSATION @conversationHandle MESSAGETYPE [BvTaskMsg](
N'Test')commit
Hello all,<o:p></o:p>
We have an issue in our production environment where the activation procedure (internal activation) is not firing in the target Queue. We have been using Service Broker for a few years and have only seen this occur once and that was in a non-production environment. We ended up restarting SQL to "fix" the issue.<o:p></o:p>
The queues are enabled, activation is enabled, and all looks well. I can even call the activation proc directly in SSMS and it processes the messages in the queue. When I try to disable activation, the ALTER QUEUE statement is blocked by system SPID 26 (Status = BACKGROUND, Command = EXECUTE, Last Batch = 06/02). Does anyone have any idea of what is going on or what I can try before restarting SQL?<o:p></o:p>
Thanks,<o:p></o:p>
Thomas
<o:p></o:p>
Windows 2008 R2 Enterprise SP1 x64<o:p></o:p>
SQL Server 2008 EnterpriseSP2 (10.0.4064.0 (X64))<o:p></o:p>
5 node cluster<o:p></o:p>
36 GB RAM
Cannot start SQL Server (SQLEXPRESS). When i tried to start the SQL Server Services, the warning: This request failed or the service did not respond in a timely fashion. Consult the event log or other application error logs for details.
I opened the Event Viewer, Error is shown as : An error occurred in the Service Broker / Database Mirroring transport manager. Error: 9694, Stare 27.
I get the following error in the transmission_queue for the message:
The target service name could not be found. Ensure that the service name is specified correctly and/or the routing information has been supplied.
The tutorial works fine: Completing a Conversation Between Databases
The only difference that I can see is that the initiator shares a queue that is related to a service that sends/receives messages with a database on a remote server instance. Do I need to create a separate queue for this?
Thanks.
Scott Mitchell
I have this SQL for my query notification.
SELECT ID, ActivityID, EventID, LocationID, VehicleID, DriverID, PassengerID, TimeStamp FROM dbo.GuestActivitiesThe date test seems to break the Special Considerations but I can't identify what rule it violates. I have all of the prescribed 'SET OPTIONS' on my database. Without the date test the query notification works correctly, I just get more records than I want.
Chris.
I have implemented a (slightly) modified version of conversation recycling using conversation timers and stored procedure activation from http://rusanu.com/2007/05/03/recycling-conversations/ . However it appears that, occasionally, deadlocks occur between the send and activated procedures on the conversation group/table. The main modification is that instead of having a column to represent the SPID in the table I am using an IdentifierType and Identifier value to identify the conversation. However I am only using the defaults (@@SPID) so I don't think that should matter in this case.
For the send side I have:
CREATE PROCEDURE [dbo].[usp_SendMessage] ( @endpointCode VARCHAR(255) = NULL, @endpointGroup VARCHAR(255) = NULL, @xmlPayload XML=NULL, @binaryPayload VARBINARY(MAX)=NULL, @varcharPayload VARCHAR(MAX)=NULL, @identifier VARCHAR(50) = @@SPID, @identifierType VARCHAR(50) = '@@SPID' ) AS BEGIN SET NOCOUNT ON DECLARE @fromService SYSNAME, @toService SYSNAME, @onContract SYSNAME, @messageType SYSNAME, @conversationTimeout INT SELECT @fromService = FromService , @toService = ToService , @onContract = OnContract , @messageType = MessageType , @conversationTimeout = ConversationTimeout FROM dbo.ServiceBrokerEndpointConfig WHERE GroupCode = @endpointGroup IF @fromService IS NULL OR @toService IS NULL OR @onContract IS NULL OR @messageType IS NULL OR @conversationTimeout IS NULL BEGIN RAISERROR ( N'Failed to get endpoint config for GroupCode ''%s''.' , 16, 1, @endpointGroup) WITH LOG; RETURN; END DECLARE @SBDialog UNIQUEIDENTIFIER DECLARE @Message XML DECLARE @counter INT DECLARE @error INT DECLARE @handle UNIQUEIDENTIFIER; DECLARE @NotNullCount INT = ((CASE WHEN @xmlPayload IS NULL THEN 0 ELSE 1 END) + (CASE WHEN @binaryPayload IS NULL THEN 0 ELSE 1 END)+ (CASE WHEN @varcharPayload IS NULL THEN 0 ELSE 1 END)) IF @NotNullCount > 1 BEGIN RAISERROR ( N'Failed to SEND because %i payload fields are filled in when no more than 1 is expected' , 16, 1, @NotNullCount) WITH LOG; RETURN; END SET @counter = 1 WHILE (1=1) BEGIN SET @handle = NULL -- Seek an eligible conversation in [ServiceBrokerConversations] -- We will hold an UPDLOCK on the composite primary key SELECT @handle = Handle FROM [ServiceBrokerConversations] WITH (UPDLOCK) WHERE Identifier = @identifier AND IdentifierType = @identifierType AND FromService = @fromService AND ToService = @toService AND OnContract = @onContract; IF @handle IS NULL BEGIN -- Need to start a new conversation for the current @Id BEGIN DIALOG CONVERSATION @handle FROM SERVICE @fromService TO SERVICE @toService ON CONTRACT @onContract WITH ENCRYPTION = OFF; -- Then the sender must listen on the -- send queue for the http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer message type and -- cleanup appropriately. IF @conversationTimeout IS NOT NULL BEGIN BEGIN CONVERSATION TIMER (@handle) TIMEOUT = @conversationTimeout; END INSERT INTO [ServiceBrokerConversations] (Identifier, IdentifierType, FromService, ToService, OnContract, Handle) VALUES (@identifier, @identifierType, @fromService, @toService, @onContract, @handle); END; IF @xmlPayload IS NOT NULL BEGIN -- Attempt to SEND on the associated conversation ;SEND ON CONVERSATION @handle MESSAGE TYPE @messageType (@xmlPayload); END ELSE IF @binaryPayload IS NOT NULL BEGIN ;SEND ON CONVERSATION @handle MESSAGE TYPE @messageType (@binaryPayload); END ELSE BEGIN ;SEND ON CONVERSATION @handle MESSAGE TYPE @messageType (@varcharPayload); END SELECT @error = @@ERROR; IF @error = 0 BEGIN -- Successful send, just exit the loop BREAK; END SELECT @counter = @counter+1; IF @counter > 10 BEGIN -- We failed 10 times in a row, something must be broken RAISERROR ( N'Failed to SEND on a conversation for more than 10 times. Error %i.' , 16, 1, @error) WITH LOG; BREAK; END -- Delete the associated conversation from the table and try again DELETE FROM [ServiceBrokerConversations] WHERE Handle = @handle; SET @handle = NULL; END END
And for the activation on the initiator queue I have:
CREATE PROCEDURE [dbo].[usp_InitiatorQueueHandler] AS BEGIN SET NOCOUNT ON DECLARE @handle UNIQUEIDENTIFIER; DECLARE @messageTypeName SYSNAME; DECLARE @messageBody VARBINARY(MAX); WHILE (1=1) BEGIN BEGIN TRAN; ;WAITFOR (RECEIVE TOP(1) @handle = conversation_handle, @messageTypeName = message_type_name, @messageBody = message_body FROM [InitiatorQueue]), TIMEOUT 5000; IF (@@ROWCOUNT = 0) BEGIN COMMIT TRAN; BREAK; END -- Call the base stored procedure to handle ending the conversation EXEC dbo.usp_BrokerHandleInitiator @handle, @messageTypeName, @messageBody COMMIT TRAN; END END GO ALTER QUEUE [InitiatorQueue] WITH ACTIVATION ( STATUS=ON, PROCEDURE_NAME=dbo.usp_InitiatorQueueHandler, EXECUTE AS OWNER, MAX_QUEUE_READERS=10 ) GO CREATE PROCEDURE [dbo].[usp_BrokerHandleInitiator] ( @handle UNIQUEIDENTIFIER, @messageTypeName SYSNAME, @messageBody VARBINARY(MAX) ) AS BEGIN SET NOCOUNT ON IF @handle IS NOT NULL BEGIN -- Delete the message from the [ServiceBrokerConversations] table -- before sending the [EndOfStream] message. The order is -- important to avoid deadlocks. IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer' OR @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog' BEGIN DELETE FROM [ServiceBrokerConversations] WHERE [Handle] = @handle; END IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/DialogTimer' BEGIN ;SEND ON CONVERSATION @handle MESSAGE TYPE [EndOfStream]; END ELSE IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog' BEGIN END CONVERSATION @handle; END ELSE IF @messageTypeName = N'http://schemas.microsoft.com/SQL/ServiceBroker/Error' BEGIN END CONVERSATION @handle; -- We could send a notification or store the error in a table for further inspection DECLARE @error INT; DECLARE @description NVARCHAR(4000); WITH XMLNAMESPACES (N'http://schemas.microsoft.com/SQL/ServiceBroker/Error' AS ssb) SELECT @error = CAST(@messageBody AS XML).value( '(//ssb:Error/ssb:Code)[1]', 'INT'), @description = CAST(@messageBody AS XML).value( '(//ssb:Error/ssb:Description)[1]', 'NVARCHAR(4000)') -- Maybe log to audit log instead? RAISERROR(N'Received error Code:%i Description:"%s"', 16, 1, @error, @description) WITH LOG; END; END END
The deadlock XML is:
<deadlock><victim-list><victimProcess id="process807dbd0c8" /></victim-list><process-list><process id="process807dbd0c8" taskpriority="0" logused="0" waitresource="METADATA: database_id = 21 CONVERSATION_GROUP($hash = 0xff26c7e1:0x478840de:0xd403bb)" waittime="2600" ownerId="8333217736" transactionname="GetDialogByHandle" lasttranstarted="2015-03-23T10:53:58.683" XDES="0x87f251c90" lockMode="X" schedulerid="2" kpid="7220" status="suspended" spid="110" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2015-03-23T10:53:58.683" lastbatchcompleted="2015-03-23T10:53:58.683" lastattention="1900-01-01T00:00:00.683" clientapp=".Net SqlClient Data Provider" hostname="COLFOQA2" hostpid="1436" loginname="dev" isolationlevel="read committed (2)" xactid="8333217704" currentdb="21" lockTimeout="4294967295" clientoption1="673185824" clientoption2="128056"><executionStack><frame procname="MYDB.dbo.usp_SendMessage" line="116" stmtstart="7540" stmtend="7696" sqlhandle="0x03001500aada77428391a0005da4000001000000000000000000000000000000000000000000000000000000"> SEND ON CONVERSATION @handle MESSAGE TYPE @messageType (@xmlPayload); </frame></executionStack><inputbuf> Proc [Database Id = 21 Object Id = 1115151018] </inputbuf></process><process id="process869a5e558" taskpriority="0" logused="588" waitresource="KEY: 21:72057594039959552 (1f1ae6770d1b)" waittime="2600" ownerId="8333217730" transactionname="user_transaction" lasttranstarted="2015-03-23T10:53:58.683" XDES="0x3e28456a8" lockMode="U" schedulerid="4" kpid="6720" status="background" spid="22" sbid="0" ecid="0" priority="0" trancount="2"><executionStack><frame procname="MYDB.dbo.usp_BrokerHandleInitiator" line="28" stmtstart="1996" stmtend="2144" sqlhandle="0x03001500f704cd06e691a0005da4000001000000000000000000000000000000000000000000000000000000"> DELETE FROM [ServiceBrokerConversations] WHERE [Handle] = @handle; </frame><frame procname="MYDB.dbo.usp_InitiatorQueueHandler" line="29" stmtstart="1014" stmtend="1172" sqlhandle="0x03001500316f56101694a0005da4000001000000000000000000000000000000000000000000000000000000"> EXEC dbo.usp_BrokerHandleInitiator @handle, @messageTypeName, @messageBody </frame></executionStack><inputbuf></inputbuf></process></process-list><resource-list><metadatalock subresource="CONVERSATION_GROUP" classid="$hash = 0xff26c7e1:0x478840de:0xd403bb" dbid="21" id="lock54fdb1800" mode="X"><owner-list><owner id="process869a5e558" mode="X" /></owner-list><waiter-list><waiter id="process807dbd0c8" mode="X" requestType="wait" /></waiter-list></metadatalock><keylock hobtid="72057594039959552" dbid="21" objectname="MYDB.dbo.ServiceBrokerConversations" indexname="PK__ServiceB__877FDFD18DF079BD" id="lock6c65b1a00" mode="U" associatedObjectId="72057594039959552"><owner-list><owner id="process807dbd0c8" mode="U" /></owner-list><waiter-list><waiter id="process869a5e558" mode="U" requestType="wait" /></waiter-list></keylock></resource-list></deadlock>
I have a clustered index on the fields I am SELECTing by and a UNIQUE index on the Handle (for the DELETE). When running the SELECT/DELETE statements against the table the query plan reports index seeks are being used:
CREATE TABLE [dbo].[ServiceBrokerConversations] ( [Identifier] VARCHAR (50) NOT NULL, [IdentifierType] VARCHAR (50) NOT NULL, [FromService] [sysname] NOT NULL, [ToService] [sysname] NOT NULL, [OnContract] [sysname] NOT NULL, [Handle] UNIQUEIDENTIFIER NOT NULL, [CreateDate] DATETIME2 (7) NULL, PRIMARY KEY CLUSTERED ([Identifier] ASC, [IdentifierType] ASC, [FromService] ASC, [ToService] ASC, [OnContract] ASC) ON [PRIMARY], UNIQUE NONCLUSTERED ([Handle] ASC) ON [PRIMARY] ) ON [PRIMARY];
What appears to be happening is the DELETE is somehow deadlocking with the SEND but I am not sure how since I am using them in the same order in both the send procedure and the activated procedure. Also, RCSI is enabled on the database I am receiving the deadlocks on.
EDIT:
I think I have found the culprit with lock acquisition order:
- In the usp_SendMessage proc:
- In the timer activated proc on the initiator queue:
Given that I think there may be a few solutions:
My ultimate goal is to eliminate any deadlocking on usp_SendMessage so that it "never" fails.
I appreciate any feedback!
Thanks
I am trying to download Service Broker External Activation Service.
According to this blog (which I am not allow to attached link)
There is a link on the page to download it, but when I try it, get this error...
"We are sorry, the page you requested cannot be found"
Where can I find the updated link to download it?
Hi,
I am following this tutorial https://technet.microsoft.com/en-us/library/bb839496(v=sql.105).aspx . I create DB instances of initiator and target on two different servers (one is my local machine). I start the conversation. At first I thought the target was never getting the messages for unknown reasons. But now I starting to think maybe the messages are never sent...
In Initiator DB,
select * from sys.transmission_queue
returns a couple of rows of the messages I sent to the target. My first question is: if the message are in the transmission_queue, does it actually mean they are waiting to be sent? The column transmission status is all blank.
I opened SQL Profiler for Initiator DB and selected every possible Service Broker event. When running the code of lesson 4 (which starts the conversation and send a message to the target), I have the following events recorded:
I am also trying to use ssbdiagnose but I am not sure how.
On the target side, transmission queue is empty. Getting the latest message returns null. Sql Profiler set up with service broker events is totally blank. I am assuming that there is nothing coming to it, therefore nothing is leaving the initiator.
What is the next step to debug this situation please?
Hi, I am trying to setup externale activation with service broker but cannot get it to work.
This is my code:
CREATE MESSAGE TYPE [PricingMessage]
CREATE CONTRACT [PricingContract]
(
[PricingMessage] SENT BY INITIATOR
)
CREATE QUEUE EquityPricingInitiatorQueue
WITH STATUS = ON
CREATE QUEUE EquityPricingTargetQueue
CREATE SERVICE EquityPricingInitiatorService
ON QUEUE EquityPricingInitiatorQueue
(
[PricingContract]
)
CREATE SERVICE EquityPricingTargetService
ON QUEUE EquityPricingTargetQueue
(
[PricingContract]
)
CREATE QUEUE EquityPricingExternalActivatorQueue
CREATE SERVICE EquityPricingExternalActivatorService
ON QUEUE EquityPricingExternalActivatorQueue
(
[http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]
)
CREATE EVENT NOTIFICATION EventNotificationEquityPricingTargetQueue
ON QUEUE EquityPricingTargetQueue
FOR QUEUE_ACTIVATION
TO SERVICE 'EquityPricingExternalActivatorService', 'current database';
I use the following code to send a message to service broker:
DECLARE @Handle UNIQUEIDENTIFIER;
BEGIN DIALOG CONVERSATION @Handle
FROM SERVICE [EquityPricingInitiatorService]
TO SERVICE 'EquityPricingTargetService'
ON CONTRACT [PricingContract]
WITH ENCRYPTION = OFF;
SEND ON CONVERSATION @Handle
MESSAGE TYPE [PricingMessage]('EQUITY');
Service Broker External Activator Windows Service runs but I get this error message:
INFOThe External Activator service is starting.
3/26/2015 5:26:59 PMINFOInitializing configuration manager ...
3/26/2015 5:26:59 PMINFOReloading configuration file C:\Program Files\Service Broker\External Activator\config\EAService.config ...
3/26/2015 5:26:59 PMINFOReloading configuration file completed.
3/26/2015 5:26:59 PMINFOInitializing configuration manager completed.
3/26/2015 5:26:59 PMINFOThe External Activator service is running.
3/26/2015 5:26:59 PMEXCEPTIONERROR = 32, No enabled application monitor is on behalf of queue [PRC01DBSQLDEV\PRC01].[PARC].[dbo].[EquityPricingTargetQueue].
This is my EAService.config file:
?xml version="1.0" encoding="utf-8"?>
<Activator xmlns="http://schemas.microsoft.com/sqlserver/2008/10/servicebroker/externalactivator"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.microsoft.com/sqlserver/2008/10/servicebroker/externalactivator EAServiceConfig.xsd"
>
<NotificationServiceList>
<NotificationService name="EquityPricingExternalActivatorService" id="100" enabled="true">
<Description>My test notification service</Description>
<ConnectionString>
<!-- All connection string parameters except User Id and Password should be specificed here -->
<Unencrypted>Data Source=PRC01DBSQLDEV\PRC01;Database=PARC;Integrated Security=true;Connection Timeout=120</Unencrypted>
</ConnectionString>
</NotificationService>
</NotificationServiceList>
<ApplicationServiceList>
<ApplicationService name="myMessageApp" enabled="true">
<OnNotification>
<ServerName>PRC01DBSQLDEV\PRC01</ServerName>
<DatabaseName>Parc</DatabaseName>
<SchemaName>dbo</SchemaName>
<QueueName>EquityPricingTargetQueue</QueueName>
</OnNotification>
<LaunchInfo>
<ImagePath>C:\svnrepo-NET\PricingCrossRef\PricingMessagePublisher\PricingMessagePublisher\bin\Debug\PricingMessagePublisher.exe</ImagePath>
<CmdLineArgs></CmdLineArgs>
<WorkDir>C:\svnrepo-NET\PricingCrossRef\PricingMessagePublisher\PricingMessagePublisher\bin\Debug</WorkDir>
</LaunchInfo>
<Concurrency min="1" max="1" />
</ApplicationService>
</ApplicationServiceList>
<LogSettings>
<LogFilter>
</LogFilter>
</LogSettings>
</Activator>
Any ideas what I am doing wrong?
Thanks.