简体   繁体   English

过期时间过后,Azure Service Bus队列中的消息仍保留在队列中

[英]Messages in Azure Service Bus Queues remain in queue after expire time

I'm working with Azure Service Bus Queues in a request/response pattern using two queues and in general it is working well. 我正在使用两个队列以请求/响应模式使用Azure Service Bus队列,并且总体而言它运行良好。 I'm using pretty simple code from some good examples I've found. 我从发现的一些好的示例中使用了非常简单的代码。 My queues are between web and worker roles, using MVC4, Visual Studio 2012 and .NET 4.5. 使用MVC4,Visual Studio 2012和.NET 4.5,我的队列介于Web角色和辅助角色之间。

During some stress testing, I end up overloading my system and some responses are not delivered before the client gives up (which I will fix, not the point of this question). 在进行一些压力测试期间,我最终使系统超载,并且在客户端放弃之前没有提供某些响应(我将解决这个问题,而不是这个问题的重点)。

When this happens, I end up with many messages left in my response queue, all well beyond their ExpiresAtUtc time. 发生这种情况时,我最终将许多消息留在响应队列中,而这些消息都远远超出了它们的ExpiresAtUtc时间。 My message TimeToLive is set for 5 minutes. 我的消息TimeToLive设置为5分钟。

When I look at the properties for a message still in the queue, it is clearly set to expire in the past, with a TimeToLive of 5 minutes. 当我查看仍在队列中的消息的属性时,显然已设置为过期,即TimeToLive为5分钟。

I create the queues if they don't exist with the following code: 如果队列不存在,我将使用以下代码创建它们:

namespaceManager.CreateQueue(
                    new QueueDescription( RequestQueueName )
                    {
                        RequiresSession = true,
                        DefaultMessageTimeToLive = TimeSpan.FromMinutes( 5 ) // messages expire if not handled within 5 minutes
                    } );

What would cause a message to remain in a queue long after it is set to expire? 在设置为过期后很长的时间内,导致邮件保留在队列中的原因是什么?

据我了解,没有后台进程可以清除这些消息,只有通过调用Receive向前移动队列光标的操作才会导致服务器跳过并处理过期的消息,并实际上返回第一个消息。未过期,或如果所有都过期,则不过期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM