简体   繁体   English

脱机处理POST请求

[英]Offline Processing of POST Request

I am developing an Application where I am submitting POST Requests to a .NET Web Service. 我正在开发一个向NET Web服务提交POST请求的应用程序。

Current implementation is to process the request instantly and give response. 当前的实现是立即处理请求并给出响应。 In actual deployment, there will be huge amount of data that needs to be processed and thus the request must be processed offline. 在实际部署中,将需要处理大量数据,因此必须脱机处理请求。

What are the strategies that can have the task accomplished 可以完成任务的策略是什么

Should I implement a Windows Service, or a scheduled task that invokes an application to perform the desired task. 我应该实现Windows服务还是调用应用程序执行所需任务的计划任务。

This might be a good case for MSMQ. 对于MSMQ,这可能是个好例子。 Your webservice can fill the queue with incoming data, and another process can read those messages and perform the necessary processing. 您的Web服务可以用传入的数据填充队列,另一个进程可以读取这些消息并执行必要的处理。

Here's a good overview of MSMQ: 以下是MSMQ的概述:

http://www.primaryobjects.com/CMS/Article77.aspx http://www.primaryobjects.com/CMS/Article77.aspx

If you have so much data it cannot be processed in real-time, I would probably setup the service to do the following: 如果您有太多数据无法实时处理,我可能会将该服务设置为执行以下操作:

ProcessRecordViaPost ProcessRecordViaPost

  1. Create new record in "Queue" database with UniqueID, and all other info to be processed 使用“ UniqueID”以及要处理的所有其他信息在“队列”数据库中创建新记录
  2. Return UniqueID to client immediatly 立即向客户返回UniqueID

ReadRecordViaGet ReadRecordViaGet

  1. Check queue, if processed return data if not return status code (number of items in queue before it?) 检查队列,是否处理了返回数据,如果没有返回状态码(队列中的项目数?)

I would also have a windows service that continually grabs the oldest item from the Queue, and processes it and moves on to the next oldest. 我还将拥有一个Windows服务,该服务不断从Queue中获取最旧的项目,并对其进行处理并移至下一个最旧的项目。

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

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