当您无法使确切的排队消息出队时,QueueTriggerAttribute有什么用?可以吗 [英] What good is a QueueTriggerAttribute when you can't dequeue the exact queued message? Or can you?

查看:58
本文介绍了当您无法使确切的排队消息出队时,QueueTriggerAttribute有什么用?可以吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我试图了解有关与队列存储一起使用的Azure Functions的QueueTriggerAttribute的信息.我可以看到  QueueTriggerAttribute允许我在添加新项目时将Azure函数绑定到队列存储事件 进入队列-我的函数调用该新消息的内容.

这有什么用?

仍然没有办法使该触发函数中的确切队列存储项出队,对吗?最好的办法就是从队列中弹出下一个可用项目,而这可能不是触发功能的项目.

我猜理论上1次单次按入队列存储将触发1次单次函数调用,在其中您可以进行1次单次弹出调用.因此,在一天结束时,您仍然可以利用这些触发器来处理队列中的所有项目-只要有 没有任何中断或任何会导致触发器无法处理的结果,从而不会导致项目卡在队列中.

我在这里错过了什么吗?我正在将队列存储与Azure Functions和QueueTrigger结合使用.我正在尝试概念化执行功能的队列驱动工作流,但是我觉得这似乎不正确-或我不理解 这里的东西.

任何澄清信息可以帮助我更好地理解这一点,将不胜感激!谢谢.

解决方案

触发器函数通过被触发,运行一些代码并停止来工作.

因此在队列触发器的示例中,您是正确的.一次按入队列存储将触发该功能运行一次.那将处理数据,并在完成后停止. 

因此,对于队列存储中的每个项目,该函数都可以连续触发多次.

所有项目处理完毕后,该功能将停止.它们的设计是相当基本和简单的.

有帮助吗?


Hi folks,

I'm trying to understand something about the Azure Functions' QueueTriggerAttribute for use with the Queue Storage. I can see that the QueueTriggerAttribute allows me to bind an Azure Function to a Queue Storage event for when a new item is added to the queue - my Function calls with the contents of that new message.

How is this useful, though?

There is still no way to dequeue that exact Queue Storage item within that triggered Function, right? The best that you could do is just pop whatever the next available item is off of the Queue, which may not be the one that triggered the Function.

I guess in theory 1 single push to the Queue Storage would trigger 1 single Function call in which you could make 1 single pop call. So at the end of the day you still can leverage these triggers to process all of the items in the queue - so long as there is no interruptions or anything that would cause a trigger to go unhandled, resulting in items stuck in the queue.

Am I missing something here? I'm looking at Queue Storage in conjunction with Azure Functions and a QueueTrigger. I'm trying to conceptualize a queue-driven workflow that executes functions, but I feel like this doesn't seem correct - or I'm not understanding something here.

Any clarifying info to help me understand this better would be greatly appreciated! Thanks.

解决方案

A trigger function works by being triggered, running some code and stopping. 

So in the example of a queue trigger you are correct. A single push to the queue storage would trigger the function to run once. That would process the data and when done it would stop. 

So the function would be able to be triggered multiple times in a row for each item in the queue storage. 

Once all items have been processed the function will stop. They are designed to be fairly basic and simple. 

Does that help? 


这篇关于当您无法使确切的排队消息出队时,QueueTriggerAttribute有什么用?可以吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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