Say a have a CreateOrder
method inside a ApiApp project.
Now I need to also trigger the CreateOrder
when I receive a CreateOrderMessage
from a ServiceBus queue.
I understand that this could be easily done using Azure Functions with a queue trigger. But that adds more complexity (introduces another concepts, will require a new repository, docs etc) So my question is simply:
Could I listen for queue messages inside of a WebApi project? (I know spinning up a new thread involves some problems)
Thanks for any suggestions
Larsi
Technically, yes, you can. As you already mentioned, this is not a recommended approach, mainly due to possible complications in manual thread management, life cycle of your WebApi app, etc. Ideally message processing should be done in a web job, worker role, function, service, etc.