Running a function after http trigger has returned (typescript)
I was trying to figure out whether it is possible to run a function after I finish and return the response on my POST method http endpoint? I use azure functions v4 (Typescript)
@blobmold
The most reliable and scalable solution is to offload any post-response logic to a queue, which can trigger another function to handle that background task asynchronously.
This decouples the background logic from the HTTP response and ensures that your HTTP function can return quickly without depending on long-running tasks.
Steps:
Return Response Immediately: The HTTP function sends the response immediately.
Queue the Work: You send a message to an Azure Storage Queue, Event Hub, or Service Bus queue.
Background Function to Process the Queue: Another function triggered by the queue processes the background task.