How to call another function with in an Azure function

前端 未结 6 822
醉话见心
醉话见心 2021-02-07 00:21

I have written 3 functions as follows

  1. create users in db
  2. fetch users from db
  3. process users

In [3] function, I will call [2] functi

6条回答
  •  执念已碎
    2021-02-07 01:09

    Durable functions support this, however, they are currently supported only when using C#, F# or JavaScript.

    Another options would be

    1. Create HTTP request for new Azure function, however, you would have to do it in a way where your function doesn't wait for response, otherwise first function in a chain would have to wait until the very last one finishes. Using Python, that would be something like:

      try:
              requests.get("http://secondAzureFunction.com/api/",timeout=0.0000000001)
      except requests.exceptions.ReadTimeout: 
              pass
      

    That seems bit hacky to me though.

    1. Use Azure Storage Queues. First function passes message to a queue, which will trigger another Azure function. That seems more elegant solution. As Fabio writes here:

    This keeps your functions small, fast and decoupled, while taking advantage of all the logic in place for provisioning, scaling and fault handling.

提交回复
热议问题