MerrionComputing / EventsSourcing-on-Azure-Functions

A library to demonstrate doing Event Sourcing as a data persistence mechanism for Azure Functions
MIT License
103 stars 20 forks source link

Demo - ApplyAccruedInterestCommand - needs to be done using durable functions #61

Open MerrionComputing opened 2 years ago

MerrionComputing commented 2 years ago

The "ApplyAccruedInterestCommand" function should fire off a durable functions orchestration (the same way that the AccrueInterest one does) so that the orchestration is all handled by that rather than event grid messages.

MerrionComputing commented 2 years ago

This could be really difficult because of this:- https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-checkpointing-and-replay#orchestrator-code-constraints

MerrionComputing commented 2 years ago

This means all asynch interaction with the Command event stream must be performed inside of an Activity type of function

MerrionComputing commented 2 years ago

In fact there needs to be some more work as when the durable function orchestration is called again (as it is for the orchestration function to work) then a new unique identifier is assigned for the Command even though it is the same orchestration...

There needs to be a way to pick up the orchestration identifier and use that instead of the new guid when the command is instantiated...or a constructor for the Command that takes the parameter of IDurableOrchestrationContext