Azure队列-功能-邮件可见性-工人? [英] Azure Queues - Functions - Message Visibility - Workers?

查看:88
本文介绍了Azure队列-功能-邮件可见性-工人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have some questions regarding the capabilities regarding Azure Queues, Functions, and Workers. I'm not really sure how this works.

场景:

  • q-notifications是Azure存储帐户中的队列.
  • fli-process-notification是Azure中绑定到q-notifications的函数.它的工作是获取队列中的第一条消息并对其进行处理.
  • q-notifications is an queue in an Azure storage account.
  • f-process-notification is a function in Azure that is bound to q-notifications. Its job is to get the first message on the queue and process it.

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

In theory when a message is added to q-notifications, the function f-process-notification should be called.

问题:

  1. 触发函数是否代替了需要工人的要求?换句话说,每次将消息放入队列时都会调用f-process-notification.

  1. Does the triggered function replace the need to have workers? In other words, is f-process-notification called each time a message is placed in the queue.

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

Suppose I place a message on the queue that has a visibility timeout of 5 minutes. Basically I am queueing the message but it shouldn't be acted on until 5 minutes pass. Does the queue trigger f-process-notification immediately when the message is placed on the queue, or will it only trigger f-process-notification when the message becomes visible, i.e. 5 minutes after it is placed on the queue?

推荐答案

在Azure Functions中,每个运行您的队列触发函数的Function App实例都将拥有自己的目标队列侦听器.它使用指数退避策略监视队列中的新工作.当新项目添加到队列中时,侦听器将把多个项目从队列中拉出(分批行为是可配置的),然后分派并行给您的函数.如果您的功能成功,则该消息将被删除,否则它将保留在队列中以进行重新处理.要回答您的问题-是的,我们尊重您指定的任何可见性超时.如果添加的邮件超时时间为5分钟,则会在此之后进行处理.

In Azure Functions, each Function App instance running your queue triggered function will have its own listener for the target queue. It monitors the queue for new work using an exponential backoff strategy. When new items are added to the queue the listener will pull multiple items off of the queue (batching behavior is configurable) and dispatch then in parallel to your function. If your function is successful, the message is deleted, otherwise it will remain on the queue to be reprocessed. To answer your question - yes we respect any visibility timeout you specify. If a message is added with a 5 minute timeout it will only be processed after that.

关于横向扩展-当您的Function App的N个实例正在运行时,它们将全部协同处理队列.每个队列侦听器将独立地从队列中提取成批消息以进行处理.实际上,将在N个实例之间平衡工作.正是您想要的:) Azure Functions正在幕后为您实现多重消费者/工人模式的所有复杂性.

Regarding scale out - when N instances of your Function App are running they will all cooperate in processing the queue. Each queue listener will independently pull batches of messages off the queue to process. In effect, the work will be load balanced across the N instances. Exactly what you want :) Azure Functions is implementing all the complexities of the multiple consumer/worker pattern for you behind the scenes.

这篇关于Azure队列-功能-邮件可见性-工人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆