You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "KouShenhai (via GitHub)" <gi...@apache.org> on 2024/02/20 05:50:19 UTC

[I] How to draw compensation nodes in the new version of seata saga designer [incubator-seata]

KouShenhai opened a new issue, #6359:
URL: https://github.com/apache/incubator-seata/issues/6359

   ![image](https://github.com/apache/incubator-seata/assets/48756217/e116d7e3-a7b3-433e-a2be-b741eca9df6f)
   
   ```json
   {
   	"Name": "reduceInventoryAndBalance",
   	"Comment": "reduce inventory then reduce balance in a transaction",
   	"Version": "0.0.1",
   	"style": {
   		"bounds": {
   			"x": 251,
   			"y": 200,
   			"width": 36,
   			"height": 36
   		}
   	},
   	"States": {
   		"ReduceInventory": {
   			"style": {
   				"bounds": {
   					"x": 168,
   					"y": 330,
   					"width": 202,
   					"height": 90
   				}
   			},
   			"Name": "ReduceInventory",
   			"IsForCompensation": false,
   			"Input": ["$.[businessKey]", "$.[count]"],
   			"Output": {
   				"reduceInventoryResult": "$.#root"
   			},
   			"Status": {
   				"#root == true": "SU",
   				"#root == false": "FA",
   				"$Exception{java.lang.Throwable}": "UN"
   			},
   			"Retry": [],
   			"ServiceName": "inventoryAction",
   			"ServiceMethod": "",
   			"Comment": "减库存",
   			"Type": "ServiceTask",
   			"Next": "ChoiceState",
   			"edge": {
   				"ChoiceState": {
   					"style": {
   						"waypoints": [{
   							"original": {
   								"x": 269,
   								"y": 420
   							},
   							"x": 269,
   							"y": 420
   						}, {
   							"x": 269,
   							"y": 465
   						}, {
   							"original": {
   								"x": 269,
   								"y": 485
   							},
   							"x": 269,
   							"y": 485
   						}],
   						"source": "ReduceInventory",
   						"target": "ChoiceState"
   					},
   					"Type": "Transition"
   				}
   			}
   		},
   		"ChoiceState": {
   			"style": {
   				"bounds": {
   					"x": 244,
   					"y": 485,
   					"width": 50,
   					"height": 50
   				}
   			},
   			"Name": "ChoiceState",
   			"Comment": "分叉",
   			"Type": "Choice",
   			"Choices": [{
   				"Expression": "[reduceInventoryResult] == true",
   				"Next": "ReduceBalance"
   			}, {
   				"Expression": "",
   				"Next": "Fail"
   			}],
   			"edge": {
   				"ReduceBalance": {
   					"style": {
   						"waypoints": [{
   							"original": {
   								"x": 269,
   								"y": 535
   							},
   							"x": 269,
   							"y": 535
   						}, {
   							"x": 269,
   							"y": 590
   						}, {
   							"original": {
   								"x": 269,
   								"y": 610
   							},
   							"x": 269,
   							"y": 610
   						}],
   						"source": "ChoiceState",
   						"target": "ReduceBalance"
   					},
   					"Type": "ChoiceEntry"
   				},
   				"Fail": {
   					"style": {
   						"waypoints": [{
   							"original": {
   								"x": 294,
   								"y": 510
   							},
   							"x": 294,
   							"y": 510
   						}, {
   							"x": 362,
   							"y": 510
   						}, {
   							"original": {
   								"x": 382,
   								"y": 510
   							},
   							"x": 382,
   							"y": 510
   						}],
   						"source": "ChoiceState",
   						"target": "Fail"
   					},
   					"Type": "ChoiceEntry"
   				}
   			}
   		},
   		"ReduceBalance": {
   			"style": {
   				"bounds": {
   					"x": 219,
   					"y": 610,
   					"width": 100,
   					"height": 80
   				}
   			},
   			"Name": "ReduceBalance",
   			"IsForCompensation": false,
   			"Input": ["$.[businessKey]", "$.[amount]", {
   				"throwException": "$.[mockReduceBalanceFail]"
   			}],
   			"Output": {
   				"compensateReduceBalanceResult": "$.#root"
   			},
   			"Status": {
   				"#root == true": "SU",
   				"#root == false": "FA",
   				"$Exception{java.lang.Throwable}": "UN"
   			},
   			"Retry": [],
   			"ServiceName": "balanceAction",
   			"ServiceMethod": "reduce",
   			"Comment": "减余额",
   			"Catch": [{
   				"Exceptions": [],
   				"Next": "CompensationTrigger"
   			}],
   			"Type": "ServiceTask",
   			"catch": {
   				"style": {
   					"bounds": {
   						"x": 292,
   						"y": 672,
   						"width": 36,
   						"height": 36
   					}
   				},
   				"edge": {
   					"CompensationTrigger": {
   						"style": {
   							"waypoints": [{
   								"original": {
   									"x": 328,
   									"y": 690
   								},
   								"x": 328,
   								"y": 690
   							}, {
   								"x": 362,
   								"y": 690
   							}, {
   								"original": {
   									"x": 382,
   									"y": 690
   								},
   								"x": 382,
   								"y": 690
   							}],
   							"source": "ReduceBalance",
   							"target": "CompensationTrigger"
   						},
   						"Type": "ExceptionMatch"
   					}
   				}
   			},
   			"Next": "Succeed",
   			"edge": {
   				"Succeed": {
   					"style": {
   						"waypoints": [{
   							"original": {
   								"x": 269,
   								"y": 690
   							},
   							"x": 269,
   							"y": 690
   						}, {
   							"x": 269,
   							"y": 742
   						}, {
   							"original": {
   								"x": 269,
   								"y": 762
   							},
   							"x": 269,
   							"y": 762
   						}],
   						"source": "ReduceBalance",
   						"target": "Succeed"
   					},
   					"Type": "Transition"
   				}
   			}
   		},
   		"Fail": {
   			"style": {
   				"bounds": {
   					"x": 382,
   					"y": 492,
   					"width": 36,
   					"height": 36
   				}
   			},
   			"Name": "Fail",
   			"ErrorCode": "",
   			"Message": "",
   			"Comment": "失败",
   			"Type": "Fail"
   		},
   		"CompensationTrigger": {
   			"style": {
   				"bounds": {
   					"x": 382,
   					"y": 672,
   					"width": 36,
   					"height": 36
   				}
   			},
   			"Name": "CompensationTrigger",
   			"Type": "CompensationTrigger",
   			"Next": "Fail",
   			"edge": {
   				"Fail": {
   					"style": {
   						"waypoints": [{
   							"original": {
   								"x": 400,
   								"y": 672
   							},
   							"x": 400,
   							"y": 672
   						}, {
   							"x": 400,
   							"y": 548
   						}, {
   							"original": {
   								"x": 400,
   								"y": 528
   							},
   							"x": 400,
   							"y": 528
   						}],
   						"source": "CompensationTrigger",
   						"target": "Fail"
   					},
   					"Type": "Transition"
   				}
   			}
   		},
   		"Succeed": {
   			"style": {
   				"bounds": {
   					"x": 251,
   					"y": 762,
   					"width": 36,
   					"height": 36
   				}
   			},
   			"Name": "Succeed",
   			"Comment": "成功",
   			"Type": "Succeed"
   		}
   	},
   	"StartState": "ReduceInventory",
   	"edge": {
   		"style": {
   			"waypoints": [{
   				"original": {
   					"x": 269,
   					"y": 236
   				},
   				"x": 269,
   				"y": 236
   			}, {
   				"x": 269,
   				"y": 310
   			}, {
   				"original": {
   					"x": 269,
   					"y": 330
   				},
   				"x": 269,
   				"y": 330
   			}],
   			"target": "ReduceInventory"
   		},
   		"Type": "Transition"
   	}
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] How to draw compensation nodes in the new version of seata saga designer [incubator-seata]

Posted by "ptyin (via GitHub)" <gi...@apache.org>.
ptyin closed issue #6359: How to draw compensation nodes in the new version of seata saga designer
URL: https://github.com/apache/incubator-seata/issues/6359


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] How to draw compensation nodes in the new version of seata saga designer [incubator-seata]

Posted by "ptyin (via GitHub)" <gi...@apache.org>.
ptyin commented on issue #6359:
URL: https://github.com/apache/incubator-seata/issues/6359#issuecomment-1970837944

   You should drag a task state and modify `IsForCompensate` to true.
   ```yaml
   {
     "Name": "ServiceTask-ht3fqkj",
     "IsForCompensation": true,
     "Input": [
       {}
     ],
     "Output": {},
     "Status": {},
     "Retry": [],
     "ServiceName": "",
     "ServiceMethod": ""
   }
   ```
   
   And then drag a line from actual task to the compensation, you will get shapes like following,
   ![StateMachine-cy3l0ma](https://github.com/apache/incubator-seata/assets/32592585/f4c184a4-0fad-4d5a-b1cd-448d155659fa)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [I] How to draw compensation nodes in the new version of seata saga designer [incubator-seata]

Posted by "KouShenhai (via GitHub)" <gi...@apache.org>.
KouShenhai commented on issue #6359:
URL: https://github.com/apache/incubator-seata/issues/6359#issuecomment-1970873010

   > 您应该拖动任务状态并修改为 true。`IsForCompensate`
   > 
   > ```yaml
   > {
   >   "Name": "ServiceTask-ht3fqkj",
   >   "IsForCompensation": true,
   >   "Input": [
   >     {}
   >   ],
   >   "Output": {},
   >   "Status": {},
   >   "Retry": [],
   >   "ServiceName": "",
   >   "ServiceMethod": ""
   > }
   > ```
   > 
   > 然后从实际任务拖动一条线到补偿,你会得到如下形状, ![状态机-cy3l0ma](https://private-user-images.githubusercontent.com/32592585/308888023-f4c184a4-0fad-4d5a-b1cd-448d155659fa.svg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDkyMDM0NjYsIm5iZiI6MTcwOTIwMzE2NiwicGF0aCI6Ii8zMjU5MjU4NS8zMDg4ODgwMjMtZjRjMTg0YTQtMGZhZC00ZDVhLWIxY2QtNDQ4ZDE1NTY1OWZhLnN2Zz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjI5VDEwMzkyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ3NWM3MGIwNTczMjIwYjQ4YzBhNWRhMDA3MDM5MTY0ZGMwMmQ1YTE1ZjRiMDg0NTBkNWUzMjRiZTZkZWE5YTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.bZiIMfE4DicqKwVhRUx55fiiBx9JHlZl_pah6K8WVys)
   
   I understand, thank you
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org