We have a stored proc that generates service broker messages that are later processed / stored for long term via an activation stored proc.
Occasionally, we see the following error when the message sender sp is invoked:
TypeName: System.Data.SqlClient.SqlException, System.Data
Message: The conversation handle "A33AA310-379C-E611-BFAC-00154D09A706" is not found.
Source: .Net SqlClient Data Provider
Here is the message sender TSQL from the sender sp that generates the service broker message. Not sure what would cause a conversation handle not found error here.
If (@MessageBody IS NOT NULL) BEGIN SET @Handle = NEWID() BEGIN DIALOG CONVERSATION @Handle FROM SERVICE ImageAuditPublisher TO SERVICE 'ImageAuditSubscriber' ON CONTRACT [http://schemas.foo.com/contracts/ImageAudit] WITH ENCRYPTION = OFF; SEND ON CONVERSATION @Handle MESSAGE TYPE [http://schemas.foo.com/messages/ImageAudit/Insert](@MessageBody); END CONVERSATION @Handle print 'ImageAudit message sent!' print CONVERT(VARCHAR(MAX), @MessageBody, 1); END
What typically causes this type of error?
Microsoft SQL Server 2014 - 12.0.4213.0 (X64)Jun 9 2015 12:06:16
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)