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

Add "interest accrued/paid" to bank example #14

Closed MerrionComputing closed 4 years ago

MerrionComputing commented 4 years ago

Add to the demo Bank Account example events for accruing and paying interest to demonstrate how the "as of" projections can be used to get around concurrency issues.

MerrionComputing commented 4 years ago

For interest accrual we need to prevent two accruals being written for one day.

For interest payment we don't need to do that as the interest due should be zero after the first payment.

MerrionComputing commented 4 years ago

For interest being paid on an overdrawn account, if the amount to pay would exceed the overdraft limit we need to extend the overdraft to cover that limit.

MerrionComputing commented 4 years ago

Error message:

Orchestrator function 'AccrueInterestForAllAccounts' failed:-
The function 'AccrueInterestForSpecificAccount' doesn't exist, is disabled, 
or is not an orchestrator function. 
Additional info: The following are the known orchestrator functions: 'AccrueInterestForAllAccounts'.

It looks like it should be calling an activity, not an orchestration...


{
  "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.29",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "activityTrigger",
      "name": "accrueInterestContext"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/RetailBank.AzureFunctionApp.dll",
  "entryPoint": "RetailBank.AzureFunctionApp.AccountFunctions.AccrueInterestForSpecificAccount"
}
MerrionComputing commented 4 years ago

Added (and documented) using azure durable function orchestration