simple_statelang_with_retry.json 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. {
  2. "Name": "simpleRetryStateMachine",
  3. "Comment": "带异常重试的测试状态机定义",
  4. "StartState": "FirstState",
  5. "Version": "0.0.1",
  6. "States": {
  7. "FirstState": {
  8. "Type": "ServiceTask",
  9. "ServiceName": "demoService",
  10. "ServiceMethod": "foo",
  11. "Next": "ChoiceState",
  12. "Input": [
  13. {
  14. "fooInput": "$.[a]"
  15. }
  16. ],
  17. "Output": {
  18. "fooResult": "$.#root"
  19. }
  20. },
  21. "ChoiceState":{
  22. "Type": "Choice",
  23. "Choices":[
  24. {
  25. "Expression":"[a] == 1",
  26. "Next":"SecondState"
  27. },
  28. {
  29. "Expression":"[a] == 2",
  30. "Next":"ThirdState"
  31. }
  32. ],
  33. "Default":"Fail"
  34. },
  35. "SecondState": {
  36. "Type": "ServiceTask",
  37. "ServiceName": "demoService",
  38. "ServiceMethod": "randomExceptionMethod",
  39. "Input": [
  40. {
  41. "barInput": "$.[fooResult]",
  42. "throwException": "$.[barThrowException]"
  43. }
  44. ],
  45. "Output": {
  46. "barResult": "$.#root"
  47. },
  48. "Retry": [
  49. {
  50. "Exceptions": ["io.seata.saga.engine.mock.DemoException"],
  51. "IntervalSeconds": 1.5,
  52. "MaxAttempts": 3,
  53. "BackoffRate": 1.5
  54. },
  55. {
  56. "IntervalSeconds": 1,
  57. "MaxAttempts": 3,
  58. "BackoffRate": 1.5
  59. }
  60. ],
  61. "Catch": [
  62. {
  63. "Exceptions": [
  64. "io.seata.saga.engine.mock.DemoException"
  65. ],
  66. "Next": "Fail"
  67. }
  68. ],
  69. "Next": "Succeed"
  70. },
  71. "ThirdState": {
  72. "Type": "ServiceTask",
  73. "ServiceName": "demoService",
  74. "ServiceMethod": "foo",
  75. "Input": [
  76. {
  77. "fooInput": "$.[fooResult]"
  78. }
  79. ],
  80. "Output": {
  81. "fooResult": "$.#root"
  82. },
  83. "Next": "Succeed"
  84. },
  85. "Succeed": {
  86. "Type":"Succeed"
  87. },
  88. "Fail": {
  89. "Type":"Fail",
  90. "ErrorCode": "NOT_FOUND",
  91. "Message": "not found"
  92. }
  93. }
  94. }