- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用内部激活设置的单机服务代理,该代理正在处理放置在队列中的项目,并且似乎正在正确关闭对话(请参阅下面的配置文件详细信息)。
sys.conversation_endpoints 中的单个记录以 CD - CLOSED 状态保留,security_timestamp 设置为 future 30 分钟,但该记录永远不会被删除。
我也有我自己的日志显示它发生了什么唯一看起来很奇怪的是启动程序被调用时调用了 session 句柄、消息类型和消息主体的空值(我的日志信息中的最后一项)
我已经包含了一个脚本(名称更改不表示实际名称),它将创建我正在使用的所有对象,并模仿我如何使用它们只需执行:
dbo.usp_QueueRequest 2, null, 'Trial'
EventClass TextData SPID Event Sequence EventSubClass
Broker:Activation 30 1394 1 - Start
Broker:Conversation CONVERSING 30 1395 1 - SEND Message
Broker:Message Classify 30 1396 1 - Local
Broker:Conversation CONVERSING 30 1397 6 - Received Sequenced Message
Broker:Activation 31 1398 1 - Start
Broker:Conversation DISCONNECTED_OUTBOUND 31 1399 2 - END CONVERSATION
Broker:Conversation Group 31 1400 2 - Drop
Broker:Message Classify 31 1401 1 - Local
Broker:Conversation DISCONNECTED_INBOUND 31 1402 7 - Received END CONVERSATION
Broker:Conversation CLOSED 31 1403 10 - Received END CONVERSATION Ack
Broker:Conversation CLOSED 30 1404 2 - END CONVERSATION
Broker:Conversation Group 30 1405 2 - Drop
Broker:Activation 30 1406 2 - Ended
Broker:Activation 31 1407 2 - Ended
Sequence Description
1 Target activation for message type: RequestMessage
2 Call fake processing procedure
3 In fake processing procedure
4 Send ReplyMessage for conversation 8B355311-5D9F-E111-93EC-A4BADBFBB13B
5 Initiator activation
6 Initiator conversation 88355311-5D9F-E111-93EC-A4BADBFBB13B message type: ReplyMessage
7 Initiator received reply from target, end converstion
8 Initiator activation
9 Target activation for message type: http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog
10 Target received end dialog
11 Initiator No conversation message type:No message type
conversation_handle is_initiator state state_desc far_service security_timestamp dialog_timer
8B355311-5D9F-E111-93EC-A4BADBFBB13B 0 CD CLOSED InitiatorService 2012-05-16 14:13:38.923 1900-01-01 00:00:00.000
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Log]') AND type in (N'U'))
DROP TABLE [dbo].[Log]
GO
CREATE TABLE [dbo].[Log](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Description] [varchar](max) NULL,
[DateTime] [date] NULL DEFAULT (getdate()))
GO
IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'BrokerUser')
DROP USER [BrokerUser]
GO
CREATE USER [BrokerUser] WITHOUT LOGIN WITH DEFAULT_SCHEMA=[dbo]
GO
IF NOT EXISTS (SELECT * FROM sys.service_message_types WHERE name = N'RequestMessage')
CREATE MESSAGE TYPE [RequestMessage] VALIDATION = WELL_FORMED_XML
IF NOT EXISTS (SELECT * FROM sys.service_message_types WHERE name = N'AReplyMessage')
CREATE MESSAGE TYPE [ReplyMessage] VALIDATION = WELL_FORMED_XML
GO
IF NOT EXISTS (SELECT * FROM sys.service_contracts WHERE name =N'MessageContract')
CREATE CONTRACT [MessageContract]
([RequestMessage] SENT BY INITIATOR,
[ReplyMessage] SENT BY TARGET)
GO
IF NOT EXISTS (SELECT * FROM sys.service_queues WHERE name = N'TargetQueue')
CREATE QUEUE TargetQueue
GO
IF EXISTS (SELECT * FROM sys.service_queues WHERE name = N'TargetQueue')
GRANT RECEIVE ON [TargetQueue] TO [BrokerUser]
GO
IF NOT EXISTS (SELECT * FROM sys.services WHERE name = N'TargetService')
CREATE SERVICE [TargetService]
ON QUEUE TargetQueue
([MessageContract])
GO
IF EXISTS (SELECT * FROM sys.services WHERE name = N'TargetService')
GRANT SEND ON SERVICE::[TargetService] TO [BrokerUser]
GO
IF NOT EXISTS (SELECT * FROM sys.service_queues WHERE name = N'InitiatorQueue')
CREATE QUEUE InitiatorQueue;
GO
IF EXISTS (SELECT * FROM sys.service_queues WHERE name = N'InitiatorQueue')
GRANT RECEIVE ON [InitiatorQueue] TO [BrokerUser]
GO
IF NOT EXISTS (SELECT * FROM sys.services WHERE name = N'InitiatorService')
CREATE SERVICE [InitiatorService]
ON QUEUE InitiatorQueue
GO
IF EXISTS (SELECT * FROM sys.services WHERE name = N'InitiatorService')
GRANT SEND ON SERVICE::[InitiatorService] TO [BrokerUser]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_FakeProcessing]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[usp_FakeProcessing]
GO
CREATE PROCEDURE [dbo].[usp_FakeProcessing]
AS
BEGIN
insert [Log] ([Description])
VALUES ('In fake processing procedure');
END
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_TargetActivation]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[usp_TargetActivation]
GO
CREATE PROCEDURE [dbo].[usp_TargetActivation]
AS
DECLARE @Handle UNIQUEIDENTIFIER;
DECLARE @Message XML;
DECLARE @MessageType sysname;
WHILE (1=1)
BEGIN
BEGIN TRANSACTION;
WAITFOR
( RECEIVE TOP(1)
@Handle = conversation_handle,
@Message = message_body,
@MessageType = message_type_name
FROM TargetQueue
), TIMEOUT 5000;
IF (@@ROWCOUNT = 0)
BEGIN
ROLLBACK TRANSACTION;
BREAK;
END
INSERT [Log] ([Description]) VALUES ('Target activation for message type: ' + + COALESCE(@MessageType,'No message type'))
-- it's an error message (some error occurred on the initiator side).
--This type of message is automatically created by SB when an END CONVERSATION command is executed with the WITH ERROR clause for the initiator
IF @MessageType =N'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
BEGIN
ROLLBACK TRANSACTION; -- roll back the message transaction. In this example there was nothing done to roll back but it is good practice
-- in the event of an error
INSERT [Log] ([Description]) VALUES ('Error occured with SB')
END CONVERSATION @Handle; -- and end the conversation (dialog) on this side (target)
BREAK; -- break out of the loop (and end the stored proc)
END
ELSE IF @MessageType = N'RequestMessage'
BEGIN
INSERT [Log] ([Description]) VALUES ('Call fake procedure')
EXEC [usp_FakeProcessing];
INSERT [Log] ([Description]) VALUES ('Add reply message for conversation ' + CAST(@Handle AS varchar(80)) + ' with message : ' + CAST(@Message as VARCHAR(4000)));
SEND ON CONVERSATION @Handle
MESSAGE TYPE [ReplyMessage] (@message)
END
ELSE IF @MessageType = N'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'
BEGIN
INSERT [Log] ([Description]) VALUES ('Target received end dialog')
END CONVERSATION @Handle;
END
COMMIT TRANSACTION;
END
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_InitiatorActivation]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[usp_InitiatorActivation]
GO
CREATE PROCEDURE [dbo].[usp_InitiatorActivation]
AS
DECLARE @Handle UNIQUEIDENTIFIER;
DECLARE @Message XML;
DECLARE @MessageType sysname;
BEGIN
INSERT [Log] ([Description]) VALUES ('Initiator activation')
WAITFOR
( RECEIVE TOP(1)
@Handle = conversation_handle,
@Message = message_body,
@MessageType = message_type_name
FROM InitiatorQueue
), TIMEOUT 5000;
INSERT [Log] ([Description]) VALUES ('Initiator ' + ISNULL(CAST(@Handle AS VARCHAR(100)) , 'No handle') + ' message type:' + COALESCE(@MessageType,'No message type') + ' Body: ' + COALESCE(CAST(@Message AS varchar(1000)),'No body'))
IF @Handle IS NOT NULL
BEGIN
IF @MessageType = N'ReplyMessage'
BEGIN
INSERT [Log] ([Description]) VALUES ('Initiator received reply from target, end converstion')
END CONVERSATION @Handle;
END
IF @MessageType = N'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'
BEGIN
INSERT [Log] ([Description]) VALUES ('Initiator received end dialog message')
END CONVERSATION @Handle;
END
END
END
GO
GRANT EXECUTE ON [usp_TargetActivation] to [BrokerUser]
GO
GRANT EXECUTE ON [usp_InitiatorActivation] to [BrokerUser]
GO
IF EXISTS (SELECT * FROM sys.service_queues WHERE name = N'TargetQueue')
ALTER QUEUE TargetQueue
WITH ACTIVATION
( STATUS = ON,
PROCEDURE_NAME = [usp_TargetActivation],
MAX_QUEUE_READERS = 1,
EXECUTE AS 'BrokerUser'
);
GO
IF EXISTS (SELECT * FROM sys.service_queues WHERE name = N'InitiatorQueue')
ALTER QUEUE InitiatorQueue
WITH ACTIVATION
( STATUS = ON,
PROCEDURE_NAME = [usp_InitiatorActivation],
MAX_QUEUE_READERS = 1,
EXECUTE AS 'BrokerUser'
);
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_QueueRequest]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[usp_QueueRequest]
GO
CREATE PROCEDURE [dbo].[usp_QueueRequest]
@numericvalue INT,
@StartDate DATE,
@TriggeredBy VARCHAR(50)
AS
BEGIN
DECLARE @Handle UNIQUEIDENTIFIER;
DECLARE @RequestMsg NVARCHAR(100);
DECLARE @MessageBody XML
DEClare @Params TABLE
(
ReadingDate SMALLDATETIME,
SiteNumber INT,
TriggeredBy VARCHAR(50)
)
INSERT INTO @Params(ReadingDate,SiteNumber, TriggeredBy)
VALUES(@StartDate, @numericvalue, @TriggeredBy)
SELECT @MessageBody = (SELECT * FROM @Params FOR XML PATH ('Params'), TYPE);
BEGIN TRANSACTION;
BEGIN DIALOG @Handle
FROM SERVICE [InitiatorService]
TO SERVICE 'TargetService'
ON CONTRACT [MessageContract]
WITH ENCRYPTION = OFF;
SEND ON CONVERSATION @Handle
MESSAGE TYPE
[RequestMessage]
(@MessageBody);
COMMIT TRANSACTION;
END
GO
最佳答案
根据我的理解和经验,一旦对话结束,你就什么也做不了。 SQL Server 将自动为您管理对话的清理。
如果您真的希望这些行消失;当您调用 END CONVERSATION
那么你应该附加 WITH CLEANUP
这将导致 SQL Server 将对话作为该事务的一部分进行清理。然而,我的理解是,让 SQL Server 为您管理清理工作可以获得更好的性能。
关于sql-server-2008 - Service Broker 在 30 分钟后将关闭的项目留在 sys.conversation_endpoints,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10621404/
我正在使用的网站上有一个非 Canvas 导航。关闭 Canvas 导航的默认状态是关闭的,这在移动网站上运行良好,因为您可以打开它并选择您的链接,但在桌面上关闭它并打开它会隐藏用户的信息,我希望它是
我有一个 NSViewController 是这样连接的: 在底部 viewController 中,我尝试使用 self.dismiss(self) 关闭它,但是,它会产生此错误: [General
我昨天制作了一个扩展的 JQuery 搜索框,它的作用就像一个魅力!但是,我在创建一个脚本时遇到问题,当用户单击搜索框时,它会关闭。 这是我的 JQuery: function expandSearc
我一辈子都无法在 API V3 中一次只显示一个信息窗口。我需要一个在下一次开放之前关闭。还希望在 map 上的任何地方关闭 infoWindow onclick。这是否在初始化函数中? 这是我的完整
关闭和清理套接字的正确方法是什么? 我在辅助线程中运行 io_service,我需要关闭与主线程的连接: void closeConnection() { ioc.post([&socket]
我的 Selenium 测试看起来像这样:客户选择金融产品,填写一些必要的数据,并在打印预览中显示条款/协议(protocol)文档(根据本地法律的要求)。打印/关闭打印预览对话框后,客户输入更多数据
我目前正在从 android 网站了解 Navigation Drawer,我正在使用他们的示例 http://developer.android.com/training/implementing-
尝试通过 expo 在模拟器上运行 react-native 应用程序时出现此错误。 Couldn't start project on Android: Error running adb: adb
方法一 function transform(ar) { var alStr = []; for(var i=0; i
我想按以下方式自定义我的抽屉导航: 我希望在抽屉打开时显示一个图标,在抽屉关闭时显示另一个图标,而不是将菜单图标稍微向左滑动的当前默认动画。 关于我在哪里可以找到类似内容的任何想法/线索? 我做了一些
我们刚刚从 0.6.2 或 0.7 升级了我们的 dropwizard 版本,发现 .yml 文件中的很多配置都发生了变化。尽管我们能够弄清楚其中的大部分,但我们无法弄清楚如何关闭“requestLo
从 celery 2.4.5 升级后,我开始让 celery 随机关闭。 我在 centOS 机器上使用 celery 3.0.12、boto 2.6 和 amazon sqs 和 django 1.
我试图包含一些语句来指导用户更多地了解文件无法打开或关闭的原因。文件在写入模式下无法打开的一些可能情况是什么?无法关闭怎么办? FILE *fp; if(!(fp = fopen("testing",
我有一个DLL,可以访问数据库并从存储在配置文件中的应用程序设置中读取连接字符串。然后,引用此DLL的应用程序将需要在其配置文件中为此配置设置设置值。 我遇到的问题是,生成的配置代码会通过Defaul
我将 UIDatePicker 添加为 UITextField 的输入 View UIDatePicker *oBirth; NSDateFormatter *dateFormat; _edit
我有以下代码: SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondVie
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
通常,按下 option 键关闭窗口会关闭应用程序中的所有窗口。在我的应用程序中,我希望它仅关闭与用户正在关闭的窗口相关的窗口。我怎样才能做到这一点?我可以为所有窗口实现 windowShouldCl
我有一个 NSWindow,它托管一个已连接到脚本处理程序的 WebView。 现在,当用户单击 WebView 上的控件上的按钮时,它会调用我的对象上的 Objective C 方法。 在这种特定情
我想根据 MBP 上的相机使用情况自动化个人工作流程。 基本上我想知道是否任何 的摄像头(内置或 USB)已打开或关闭,因此我可以运行我将创建的程序或脚本。 我认为如果我需要轮询相机状态也可以,但基于
我是一名优秀的程序员,十分优秀!