Search code examples
azureazure-functionscontainersinstanceazure-durable-functions

Is each activity function in Azure's Durable functions a separate instance?


I am planning to program with Azure's Durable functions.
I am a beginner and have looked at a lot of documentation, but I couldn't understand the behavior of each function.

Are client function, orchestrator function, and activity functions separated different instances? Furthermore, if there are an activity function A and an activity function B, are they executed in different instances?

I am not sure if each function is an instance or a container.
I would appreciate it if you knowledgeable people could help me.

I heard that functions are communicating with each other on the network. I would like to know if functions are instances or containers. If you have official documentation, please introduce it to me.


Solution

  • Azure Durable Functions:

    Orchestrator Function: An orchestrator function is a piece of code that defines and manages the workflow's logic. It coordinates the execution of other functions, including activity functions. Each time you start an instance of an orchestrator function, it represents a unique instance of that workflow. This means that different invocations of the orchestrator function create separate instances.

    Activity Function: Activity functions are units of work within your workflow. They perform specific tasks or actions. Activity functions can be invoked by orchestrator functions, and each invocation of an activity function runs independently. Each time you call an activity function, it can be considered a separate instance of that activity function.

    Client Function: The client function is not a separate function type in itself; it's code initiates the execution of an orchestrator function. The client function doesn't represent an instance; it's the entry point for starting a new instance of an orchestrator function.

    Summary:

    • Orchestrator functions create instances of workflows.
    • Activity functions are invoked by orchestrator functions and can be thought of as separate instances for each invocation.
    • Client functions are used to trigger orchestrator functions but do not represent instances themselves.

    Each instance (an orchestrator or an activity) has its own state and execution context, allowing you to build stateful, long-running workflows. Instances are managed by Azure Durable Functions.

    For reference check these MS Docs

    I have created a Durable Function in my machine using Python with reference to MS Docs.

    enter image description here

    enter image description here

    enter image description here