When the Azure functions call multiple PlayFab API internaly,
Are there any good design for 2-phase commit like application?
And Are there any good design for a application like with role-back system?
When the Azure functions call multiple PlayFab API internaly, Are there any role-back best practise for Azure Functions?
I'm thinking of the following logic
What I want to do: Give the player an item and equip it as the initial data of the game. Details of what you want to do.
1. PlayFab grants items to players Enhanced consumable items Points (virtual currency)
2. Consume points to increase item enhancement (item level)
3. Keep the item level of this enhancement in JSON in Item Inventry Custom Data
I'm trying to use Azure Function for this process, is that the right approach?
At that time, the process becomes complicated. What kind of design should I do?
I asume the logic on Azure Functions like:
API requests for these items
* Instance ID A of the item to be strengthened (example: sword)
* Instance ID B of the item with the enhancement effect (Example: Item Enchanter +5)
* Virtual currency
1. GetUserInventoryAsync: Get the item list that the user has
2. Obtain the level of equipment to be strengthened from among them Sword: 100
3. In Instance A, add level 5 to the custom value (UpdateUserInventoryItemCustomDataAsync)
4. ConsumeItemAsync consumes enhancement item B
5. Consume points (virtual currency) with SubtractUserVirtualCurrencyAsync.
Question: Step 4 and Step 5 call different APIs. If 4 succeeds and 5 fails, the player's data will be inconsistent. How can I prevent this inconsistency?
(Example 2) Case of new character generation
1. For the first time the player plays the game
2. New character generation
3. I want to install the default equipment
4. Save equipment information in the character's Title Data
Make an API request to the following information in Azure Functions
* Character name
* Character class
1. Grant CharacterToUserAsync ()
2. Rewrite equipment information with UpdateCharacterReadOnlyDataAsync
Question"
In step 2, data inconsistencies can occur if the API returns an error. How to prevent it,,,How can I prevent this inconsistency?