Azure Service Bus Premium-地理恢复-丢弃的消息

时间:2019-08-12 18:08:16

标签: azure azureservicebus azure-servicebus-queues

我在一个区域中具有Premium Service Bus名称空间,并在另一个区域中创建了另一个名称空间,作为辅助数据库。我已在主数据库上启用了Geo-Recovery,并已配置了与辅助数据库的配对。我运行了一个测试以连续向主题发送消息,并且有一个接收应用程序已订阅该主题。发送方将发送“发送消息:消息{序列号}”,接收方将显示“接收消息:序列号:{SB分配的序列号}正文:消息{序列号}”。但是,当我尝试通过门户向辅助服务器发起故障转移时,我注意到尽管发件人继续发送消息,但接收者在完成故障转移时仍丢弃了一些消息。请看下面:

发件人的日志:

Sending message: Message 244
Sending message: Message 245
Sending message: Message 246
Sending message: Message 247
Sending message: Message 248
Sending message: Message 249
Sending message: Message 250
Sending message: Message 251
Sending message: Message 252
Sending message: Message 253
Sending message: Message 254
Sending message: Message 255
Sending message: Message 256
Sending message: Message 257
Sending message: Message 258
Sending message: Message 259
Sending message: Message 260

接收方的日志:

Received message: SequenceNumber:255 Body:Message 244
Received message: SequenceNumber:256 Body:Message 245
Received message: SequenceNumber:257 Body:Message 246
Received message: SequenceNumber:258 Body:Message 247
Message handler encountered an exception Microsoft.Azure.ServiceBus.UnauthorizedException: Connection rejected after GeoDRFailOver. TrackingId:7bb0b78d-2bf5-4807-8bcb-c831b00c6692, SystemTracker:AmqpGatewayProvider, Timestamp:2019-08-12T17:42:38
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<OnReceiveAsync>d__86.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.RetryPolicy.<RunOperation>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Azure.ServiceBus.RetryPolicy.<RunOperation>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<ReceiveAsync>d__64.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<ReceiveAsync>d__62.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.ServiceBus.MessageReceivePump.<MessagePumpTaskAsync>d__11.MoveNext().
Exception context for troubleshooting:
- Endpoint: rjpremium.servicebus.windows.net
- Entity Path: topic1/Subscriptions/sub1
- Executing Action: Receive
Received message: SequenceNumber:1 Body:Message 254
Received message: SequenceNumber:2 Body:Message 255
Received message: SequenceNumber:3 Body:Message 256
Received message: SequenceNumber:4 Body:Message 257
Received message: SequenceNumber:5 Body:Message 258
Received message: SequenceNumber:6 Body:Message 259
Received message: SequenceNumber:7 Body:Message 260

247和254之间的消息被丢弃。尽管发送方发送了所有这些消息,但是接收方从未收到这些消息。如果我启用了Geo-Recovery,接收方是否也应该收到这些消息?

2 个答案:

答案 0 :(得分:1)

使用Azure Service Bus(Premium)的地理灾难恢复功能时,必须首先将主要和辅助名称空间配对。完成后,您将获得一个别名,从该时间点开始使用。别名可确保发生故障转移时,连接到主要名称空间的应用程序继续运行。确保在发送方和接收方应用程序中使用颁发的别名。有关详细信息,请参阅documentation

答案 1 :(得分:1)

首先,引用docs(正如肖恩·费尔德曼(Sean Feldman)也同时指出)

“地理灾难恢复当前仅确保配对时将元数据(队列,主题,订阅,过滤器)从主名称空间复制到辅助名称空间。”

这意味着尚未(尚未)复制邮件。

第二,GeoDR适用于极少数情况,您必须搬出该地区,因为某些地方完全被破坏了。这意味着上述测试场景不太可能反映任何现实。您将面临危机情况,您将发生断电,然后要非常刻意地放弃该地区并进行故障转移,不仅是Service Bus,而且还有那里的所有其他设备。