首先有关设置的一些信息:
- 我们正在运行 NServiceBus v4.6.3
- 分发器在具有集群队列的集群机器上运行。
- TimeoutManager 在工作人员上禁用,在分发服务器上启用。
我们正在经历什么
- 当处理 Saga-timeout 时,存储队列中的消息数会增加 1。
- 当消息被延迟时,存储队列中的消息数量会增加一。
我们知道什么
超时消息直接传送到特定的本地队列(在请求超时的服务器上),而不是集群队列。这绕过了常规路径,该路径涉及从存储队列中删除消息并将目标队列传递到工作线程。工作人员不知道这一点,并在处理超时消息后报告它已准备好处理新消息。
这种行为的原因是存储在 TimeoutData 中的目标队列被设置为工作器上的本地队列,而不是集群队列。这是一个例子:
{
"Destination": {
"Queue": "DemoService",
"Machine": "STAGESVC04"
},
"SagaId": "40bf1976-dab0-48a3-8e20-a39d00b59bb9",
"State": "PD94bWwgdmVyc2lvbj0iMS4wIiA/Pg0KPE1lc3NhZ2VzIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zPSJodHRwOi8vdGVtcHVyaS5uZXQvUmlrc3RvdG8uU2VydmljZS5CZXR0aW5nLk5TZXJ2aWNlQnVzSGFuZGxlcnMuU2FnYXMuVGVzdFNhZ2EiPgo8SVRoZVRpbWVvdXQ+CjwvSVRoZVRpbWVvdXQ+CjwvTWVzc2FnZXM+DQo=",
"Time": "2014-09-05T09:02:14.2110980Z",
"CorrelationId": "60558fe4-7111-4fe3-a4ff-a39d00b5c060\\0",
"OwningTimeoutManager": "DemoService",
"Headers": {
"NServiceBus.MessageId": "60558fe4-7111-4fe3-a4ff-a39d00b5c060",
"NServiceBus.CorrelationId": "60558fe4-7111-4fe3-a4ff-a39d00b5c060",
"NServiceBus.OriginatingEndpoint": "DemoService",
"$.diagnostics.originating.hostid": "23d0f908b1691ba8111e8ac282989a3d",
"NServiceBus.MessageIntent": "Send",
"NServiceBus.Version": "4.6.3",
"NServiceBus.TimeSent": "2014-09-05 09:01:44:211098 Z",
"NServiceBus.OriginatingMachine": "STAGESVC04",
"NServiceBus.SagaId": "40bf1976-dab0-48a3-8e20-a39d00b59bb9",
"NServiceBus.IsSagaTimeoutMessage": "True",
"NServiceBus.SagaType": "DemoService.NServiceBusHandlers.Sagas.TestSaga.TestSaga, DemoService.NServiceBusHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"NServiceBus.OriginatingSagaId": "40bf1976-dab0-48a3-8e20-a39d00b59bb9",
"NServiceBus.OriginatingSagaType": "DemoService.NServiceBusHandlers.Sagas.TestSaga.TestSaga, DemoService.NServiceBusHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"NServiceBus.ContentType": "text/xml",
"NServiceBus.EnclosedMessageTypes": "DemoService.NServiceBusHandlers.Sagas.TestSaga.ITheTimeout, DemoService.NServiceBusHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"NServiceBus.RelatedTo": "232aa1a9-dea2-4d98-9251-a39d00b59bc7",
"NServiceBus.ConversationId": "4661130d-a961-4b1d-abda-a39d00b59beb",
"WinIdName": "",
"CorrId": "60558fe4-7111-4fe3-a4ff-a39d00b5c060\\0",
"NServiceBus.IsDeferredMessage": "True",
"NServiceBus.Temporary.DelayDeliveryWith": "00:00:30",
"NServiceBus.Timeout.Expire": "2014-09-05 09:02:14:211098 Z",
"NServiceBus.Timeout.RouteExpiredTimeoutTo": "DemoService@STAGESVC04",
"NServiceBus.Timeout.ReplyToAddress": "DemoService@STAGEMSMQ01"
}
}
我不确定我们遇到的是 NServiceBus 中的错误或配置错误。有人知道吗?