[英]How to transfer content from httpWebRequest from Web Role to a Worker Role in Microsoft Azure
Help a newbie out please: 请帮助新手:
What I have in mind is this: 我想到的是:
Items #3 and #4 is where I have most of the problem with: not sure what do do here. 项目#3和#4是我最大的问题所在:不确定在这里做什么。
Item #6 i believe i have SOME idea on what to do, but would love to hear your suggestions 项目#6我相信我对做什么有一些想法,但很想听听您的建议
What I know is this: 我所知道的是:
Appreciate all your inputs in advance. 预先感谢您的所有输入。
You can certainly find out an internal endpoint of a worker role instance from a web role instance using code. 您当然可以使用代码从Web角色实例中找出辅助角色实例的内部端点。 See this thread for more details: How to get web role input endpoint in worker role?
有关更多详细信息,请参见此线程: 如何在辅助角色中获取Web角色输入端点? .
。
However I see one problem with your approach. 但是,我发现您的方法存在一个问题。 You mentioned that web role will communicate with worker role using an internal endpoint to send the data and then wait for worker role to process that data and send the response back.
您提到过,Web角色将使用内部端点与辅助角色进行通信以发送数据,然后等待辅助角色处理该数据并将其发送回。 While technically its possible to do so, it would cause some scalability issues because you're now tying up your web role.
从技术上讲,虽然这样做是可能的,但会引起一些可伸缩性问题,因为您现在要绑定自己的Web角色。 Furthermore, you have to decide in your code which worker role instance should process the data (assuming there're more than one instances).
此外,您必须在代码中决定哪个工作角色实例应处理数据(假设有多个实例)。
My recommendation would be to get the request and persist the request data in blob storage. 我的建议是获取请求并将请求数据保留在Blob存储中。 You will get a URL of the blob.
您将获得该Blob的URL。 Then write a message in a queue with the URL of the blob.
然后将消息与Blob的URL写入队列。 Once the message is written to the queue, your web role can notify the user that the request has been submitted.
将消息写入队列后,您的Web角色可以通知用户请求已提交。 Worker role instances would poll this queue periodically and work on the message.
辅助角色实例将定期轮询此队列并处理消息。 They will get the blob URL from message contents, fetch the contents and work on it.
他们将从消息内容中获取Blob URL,获取内容并对其进行处理。 Once the work is processed, worker role could write to a queue/table indicating that the work is completed.
一旦处理完工作,辅助角色就可以写入队列/表,指示工作已完成。 Web role could constantly poll this table or queue and once the task is completed it can notify the user.
Web角色可以不断轮询该表或队列,一旦任务完成,它可以通知用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.