0

工作场景:

  1. 将 Msg1 发布到主题
  2. 将 Msg2 发布到主题
  3. 读取 Msg1、Msg2

不工作:

  1. 将 Msg1 发布到主题
  2. 通过订阅者从主题中读取 Msg1,但我没有标记为完成。(仍在队列中)
  3. 将 Msg2 发布到主题
  4. 读Msgs..实际:我只读Msg2 期望:想读Msg1,Msg2。

       if (namespaceManager.TopicExists(topic))
                    {
                        var lstOfValues = new List<SITConfirmation>();
                        SubscriptionClient Client = SubscriptionClient.CreateFromConnectionString(ConfigurationManager.ConectionString(), topic, subscriber);
                        IEnumerable<BrokeredMessage> messages = await Client.ReceiveBatchAsync(10, TimeSpan.FromMilliseconds(500));
                     }
    
4

1 回答 1

1

ReceiveBatchAsync(messageCount)不保证您会获得请求的确切消息数量。网关可以有或没有所有的消息。它将返回它拥有的任何东西(网关可能有更少/更多/相同数量的实际存储在代理实体上的消息)。

文档中:

由于这是一个近似值,因此可能会返回比 messageCount 更少或更多的消息。

于 2016-12-30T20:28:36.140 回答