小编God*_*ers的帖子

何时使用LocalRedirect与RedirectToPage

使用ASP.Net Core 2.1 Razor Pages,使用LocalRedirect和RedirectToPage的最佳做法是什么?

当重定向到当前网站内的页面时,它们似乎可以互换使用.一个人比另一个人有优势吗?

razor-pages asp.net-core-2.1

8
推荐指数
1
解决办法
2227
查看次数

设置通过Azure函数输出绑定添加到Azure队列的消息的VisibilityTimeout

我有一个TimerTrigger函数,并且输出绑定是Azure队列。

这个想法是,计时器每10分钟运行一次,它将查看数据库中的一个视图,并迭代返回的所有行,并将它们作为消息添加到队列中。

以下是我的示例TimerTrigger。将消息添加到队列中效果很好。

但是,在我的实际情况中,有些行将需要立即执行,而另一些行则将延迟几分钟(每行变化)。我计划通过使用VisibilityTimeout处理消息来处理延迟。

不幸的是,通过字符串进行绑定无法让我设置值。CloudQueueMessage.VisiblityTimeout(以下使用)是只读的。

#r "Microsoft.WindowsAzure.Storage"

using System;
using Microsoft.WindowsAzure.Storage.Queue;

public static void Run(TimerInfo myTimer,  ICollector<CloudQueueMessage> outputQueueItem, TraceWriter log)
{
    log.Info($"C# Timer trigger function executed at: {DateTime.Now}");    


    //- Add a message to be processed now.
    CloudQueueMessage msg = new CloudQueueMessage("Now");
    outputQueueItem.Add(msg);

    //- Add a message to be processed later.
    //- this code below won't work because NextVisibleTime is readonly.
    //- is there some way to set the VisibilityTimeout property before queueing?
    msg = new CloudQueueMessage("Later");
    DateTime otherDate = DateTime.Now.AddMinutes(3); …
Run Code Online (Sandbox Code Playgroud)

visibility azure azure-storage-queues azure-functions

5
推荐指数
1
解决办法
1254
查看次数

Azure队列-功能-邮件可见性-工人?

我对有关Azure队列,函数和工作器的功能有一些疑问。我不确定这是如何工作的。

场景:

  • q通知是Azure存储帐户中的队列。
  • f-process-notification是Azure中绑定到q-notifications的功能。它的工作是获取队列中的第一条消息并进行处理。

理论上,当将消息添加到q通知时,应调用f-process-notification函数。

问题:

  1. 触发功能是否取代了需要工人的需求?换句话说,每当一条消息放入队列时,都会调用f-process-notification。

  2. 假设我在可见性超时为5分钟的队列中放置了一条消息。基本上,我正在对消息进行排队,但是直到5分钟后才应采取行动。队列是在将消息放入队列时立即触发f-process-notification还是仅在消息变为可见时(即,将消息放入队列后5分钟)才触发f-process-notification?

visibility azure-storage-queues azure-functions

3
推荐指数
1
解决办法
477
查看次数