富贵资源网 Design By www.hznty.com
复制代码 代码如下:
USE TestDB
declare @conversation uniqueidentifier
while exists (select 1 from sys.transmission_queue )
begin
set @conversation = (select top 1 conversation_handle from sys.transmission_queue )
end conversation @conversation with cleanup
end
那么客户端接受到的消息如果没有处理,也会积攒在客户端队列中,其实就相当于许多未读邮件,我们可以使用以下脚本读取队列 ,读取后队列自动清空:
复制代码 代码如下:
USE TestDB
DECLARE @RecvReplyMsg NVARCHAR(100) ;
DECLARE @RecvReplyDlgHandle UNIQUEIDENTIFIER ;
BEGIN TRANSACTION ;
WHILE ( 1 = 1 )
BEGIN
WAITFOR
( RECEIVE TOP(1)
@RecvReplyDlgHandle = conversation_handle,
@RecvReplyMsg = message_body
FROM dbo.Test_TargetQueue
), TIMEOUT 1000 ;
END CONVERSATION @RecvReplyDlgHandle ;
SELECT @RecvReplyMsg AS ReceivedReplyMsg ;
END
COMMIT TRANSACTION ;
USE TestDB
declare @conversation uniqueidentifier
while exists (select 1 from sys.transmission_queue )
begin
set @conversation = (select top 1 conversation_handle from sys.transmission_queue )
end conversation @conversation with cleanup
end
那么客户端接受到的消息如果没有处理,也会积攒在客户端队列中,其实就相当于许多未读邮件,我们可以使用以下脚本读取队列 ,读取后队列自动清空:
复制代码 代码如下:
USE TestDB
DECLARE @RecvReplyMsg NVARCHAR(100) ;
DECLARE @RecvReplyDlgHandle UNIQUEIDENTIFIER ;
BEGIN TRANSACTION ;
WHILE ( 1 = 1 )
BEGIN
WAITFOR
( RECEIVE TOP(1)
@RecvReplyDlgHandle = conversation_handle,
@RecvReplyMsg = message_body
FROM dbo.Test_TargetQueue
), TIMEOUT 1000 ;
END CONVERSATION @RecvReplyDlgHandle ;
SELECT @RecvReplyMsg AS ReceivedReplyMsg ;
END
COMMIT TRANSACTION ;
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...