一个队列上有多个Azure Webjob实例 [英] Multiple Azure Webjob instances on one queue

查看:77
本文介绍了一个队列上有多个Azure Webjob实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法,让我的Azure Webjob的多个实例一起运行并清除队列.

I'm looking for a way to have multiple instances of my azure webjob running together and clearing my queue.

我们应用程序的功能之一是减少用户对他们网站上每个页面浏览量的信任(由ajax调用).目前,我们有将近600个这样的网站,他们网站的每个页面浏览量都在产生一个呼叫,导致从他们的帐户(SQL Azure)中扣除信用额.

One of the functions of our application is to decrease the user's credit on every page view on their site (called by an ajax). We currently have close to 600 of these websites and every page view of their site is generating a call that results in a credit being deducted from their account (SQL Azure).

这是实时发生的,并且我们在其中任何一次调用中都调用sql服务器.到目前为止,它工作正常,但是我想将此任务转移到webjobs和队列中,因为我认为这样做是更好的方法.

This happens real time in the and we are calling the sql server on ever one of these calls. So far it's working fine but I'd like to offload this task to the webjobs and a queue since I believe that is a better way of doing this.

我的问题是,如何设置Webjob或一系列Webjob以使用同一队列,并共同完成队列中的所有任务.如果说队列达到大量按摩,是否有一种方法可以分解其中的更多信息?

My question is, how do I setup the webjob or a series of them to work with the same queue and work together to finish everything in the queue. Is there a way of spinning up more of them if lets say the queue reaches a high amount of massages?

今天早上我到处都在搜索此信息,但不幸的是我找不到任何信息.

I've searched everywhere this morning for this information but unfortunately I can't find anything on this.

推荐答案

您可以使用Azure WebJobs SDK编写一个Web作业,该作业由队列中的消息触发,然后启动多个实例(通过缩放).每个作业实例将从队列中选择不同的消息.

You can write a web job, using the Azure WebJobs SDK, that is triggered by the messages in your queue and then spin up multiple instances (by scaling). Each job instance will pick a different message from the queue.

您可以使用Azure网站规模功能.每个额外的网站实例也意味着一个额外的webjobs实例. http://azure.microsoft.com/en-us/文档/文章/网站规模/

You can use the Azure Websites scale feature. Each extra website instance means an extra webjobs instance too. http://azure.microsoft.com/en-us/documentation/articles/web-sites-scale/

如果要基于队列消息的数量进行扩展,它会(不确定!)认为您可以使用管理API进行编程扩展.

If you want to scale based on the number of queue messages, it think (not sure!) that you can use the management API to scale programmatically.

这篇关于一个队列上有多个Azure Webjob实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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