gpt4 book ai didi

c# - 查看 Azure ServiceBus 消息不会返回计划的消息

转载 作者:太空宇宙 更新时间:2023-11-03 12:23:49 26 4
gpt4 key购买 nike

我尝试使用 ScheduledEnqueueTimeUtc 来安排消息以供将来处理,但 Peek 仅返回事件消息和延迟消息。

这是我用来查看消息的代码:

    public static async Task<IEnumerable<BrokeredMessage>> GetMessagesAsync(string connectionString, string queueName, int take)
{
var queue = QueueClient.CreateFromConnectionString(connectionString, queueName);
return await queue.PeekBatchAsync(take).ConfigureAwait(false);
}

不会返回 ScheduledEnqueueTimeUtc 设置为 future 某个时间的预定消息。

在预定时间之后,我收到 State = Scheduled 的消息,但这不是我所期望的。

从名称“ScheduledEnqueueTimeUtc”来看,消息不可见是有道理的,因为它尚未排队。然而,如果我可以有无限数量的预定消息卡在那里而无法看到它们,这会让我很烦恼。

我是否犯了一个错误,或者是否有其他方法来获取 future 预定的消息?

最佳答案

我发现了问题:我正在将预定消息发送到主题 - 而不是队列。

显然,这意味着在预定时间之前该消息在订阅队列中不可见。

使用常规队列,Peek 按预期工作,并返回事件消息、延迟消息和计划消息,正如人们所期望的:-)

关于c# - 查看 Azure ServiceBus 消息不会返回计划的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46070962/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com