简体   繁体   中英

Queue incoming Web API 2 calls

I receive a big amount of data to my web api service that takes a while to process (Parse, process data, put in DB, etc).

The problem I'm having is that the processing is not always finished when the next chunk of data comes. I don't want to process the data simultaneously but rather wait for the first call to finish before processing the next.

I've looked into RabbitMQ and other solutions similar - the problem is that I don't have a process running checking the queue at all times "while(true)" style.

Any suggestions ?

You can't handle a queue without a running process. If you make your API call wait untill the processing slot is ready you'll get timeouts.

You must use a solution like RabbitMQ and a worker process that process incoming data. Nothing prevents this process from pushing result using SignalR.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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