I am new to .NET/C# and I am wondering how oyu could achieve the following scenario:
I need a REST Api with has one endpoint, which accepts a message(string). That message should be stored in a Queue and then there should be one or multiple Threads that consume and process this Queue.
I do not want to use Hangfire, RabbitMq etc. The only thing that I have seen is to use NancyFx to create the Rest API in a Console application and from there I can achieve the described scenario, but is it possible in .NET Core WebApi, because you cannot create Threads there ?
You can use Asp.Net Core Webapi and use
TaskInstead ofThread. If you don't use any other third parties such as RabbitMq, Redis, or other message queue, you have to create a shared variable such as aDictionaryor aListand implement synchronization mechanism (such as usingLock) by yourself to avoid any problem caused by concurrency.