简体   繁体   English

Azure WebJob QueueTrigger执行

[英]Azure WebJob QueueTrigger execution

I am running multiple simultaneous instances of a QueueTrigger within an Azure webjob. 我在Azure webjob中运行多个QueueTrigger的同时实例。 It is a single function, but called multiple times in parallel. 它是单个函数,但并行调用多次。

My function uses static variables to cache data that is used multiple times. 我的函数使用静态变量来缓存多次使用的数据。

Sometimes when the functions get run I have collisions on the static objects that could only be explained by multiple processes trying to access them at the same time, but I was lead to believe that each instance of a queuetrigger runs in isolation. 有时候,当函数运行时,我会在静态对象上发生冲突,只能通过多个进程同时尝试访问它们来解释,但我相信每个queuetrigger实例都是孤立运行的。

So my questions are; 所以我的问题是;

Are queuetrigger instances executed in isolation? queuetrigger实例是否孤立执行?

If not, is there a specific event that triggers when the "instance" is loaded so that static objects can be loaded? 如果没有,是否有一个特定的事件在加载“实例”时触发,以便可以加载静态对象?

Figured it out with some experimentation. 通过一些实验来计算出来。

QueueTrigger instances are run as part of the process that the WebJob runs inside, and are not executed in isolation. QueueTrigger实例作为WebJob在其中运行的进程的一部分运行,并且不是孤立执行的。

WebJobs automatically shut themselves down if they are not told to stay open and will lose all static data. 如果没有告诉他们保持打开并且将丢失所有静态数据,WebJobs会自动关闭自己。 This can cause confusing behavior, but is by design. 这可能会导致令人困惑的行为,但这是设计上的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM