5

I have an azure functions app that has a long running operation. I would like to trigger it via HTTP (for simplicity) with some input and no output. I don't want to keep the HTTP connection open for the whole time that the job is running.

What are my options for building a functions app where the runtime accepts some data and then immediately returns control to the caller before invoking my run.csx file?

1 Answer 1

9

I'd recommend a design where your http function accepts + validates the work request and enqueues a message to a work queue that another function is listening on. So you'd start from the http trigger template, and add a queue output binding.

This way your request returns immediately, and your long running work can be done in the context of a Queue triggered function. One benefit is that you'll get the retry behavior of queue triggers for free. E.g. if your long running task fails half way through, the message will be reprocessed after some time (queue messages are only deleted from the queue after they are successfully processed).

The separation also gives you more options in the future for how the work is scheduled. E.g. the work could be kicked off via a queue output of another function in the future, w/o requiring an http request.

1
  • Thanks @mathewc, that chaining construct would work perfectly for me
    – Joon
    Jun 30, 2016 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.