Skip to content

davidkpiano/dependent-actors

 
 

Repository files navigation

DDR Actor Model Sample

DDR sample written in Javascript, supports multiple programs with file-based dependencies, as defined here.

Individual programs are represented as actors that keep track of their own state, using the durable entities feature of Azure Durable Functions 2.0. Dependencies are represented as Azure Event Grid events.

DDR

Prerequisites

To run locally

  1. Edit create-program-topic-and-sub.sh to include details of your environment (Azure sub ID, storage account, resource group, etc.) and then run the script to create an event grid topic and subscription for programs to post when dependencies are satisfied. Note the EG topic and key output on the command line
  2. Create a local.settings.json file from local.settings.json.template and update the program topic key and endpoint values with those from the previous step
  3. (you can ignore heartbeat topic key/endpoint for local debugging)
  4. Modify ProgramDependencyMapping.js to reflect desired programs and dependent files. Note that mappings are defined bi-directionally
  5. Run the Function app inside the VS Code debugger, and use the sample Postman requests to interact with it
    • FileEvent: simulates a "blob created" event as a program dependency
    • HeartbeatEvent: simulates the timer heartbeat used for injecting the element of time into actor processing; you typically do not need to fire these events manually
    • ResetProgram: re-initializes a program actor to its default state
    • ManualInvokeProgram: immediately causes the target program to fire its "dependencies satisfied" event (regardless of its current state) and then resets its state to default
    • EnableProgram: ensures the 'enabled' flag for a given program is set to True
    • DisableProgram: ensures the 'enabled' flag for a given program is set to False
    • QueryProgramState: returns the dependency state for a program
  6. DEBUGGING TIP: View events emitted for programs with satisfied dependencies in the queue created in the first step above

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 88.1%
  • Shell 11.9%