简体   繁体   English

Azure服务总线问题

[英]Azure Service Bus issue

I'm working on a project where we would like to use ServiceBus like a classical queue, for messaging. 我正在一个项目中,我们希望像传统队列一样使用ServiceBus进行消息传递。 Very often I see messages in queue that I can't get. 我经常会在队列中看到无法收到的消息。 These messages are active (not dead letters). 这些消息是活动的(不是空字母)。 I don't receive any exceptions, it waits for timeout and then message is null without any issues. 我没有收到任何异常,它等待超时,然后消息为null,没有任何问题。 I've already checked size of messages but all are less then 1.5 KB. 我已经检查了邮件的大小,但是所有邮件都小于1.5 KB。

try
...
QueueClient _queueClient = QueueClient.CreateFromConnectionString(Properties.Settings.Default.ServiseBusConnectionString, Properties.Settings.Default.StatQueueName);

var count = 1000;

for (var i = 1; i <= count; i++)
{
 var message = _queueClient.Receive();
 //timeout 
 if (message == null)
 {
  //message is null :(
  continue;
 }
}
...
catch

阅读如何从队列接收消息,并确保使用_queueClient.Complete()_queueClient.Abandon()完成每条消息。

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

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