simple_statelang_with_status_matches.json 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. {
  2. "Name": "simpleStatusMatchingStateMachine",
  3. "Comment": "带Task执行状态匹配的测试状态机定义",
  4. "StartState": "FirstState",
  5. "Version": "0.0.1",
  6. "States": {
  7. "FirstState": {
  8. "Type": "ServiceTask",
  9. "ServiceName": "demoService",
  10. "ServiceMethod": "foo",
  11. "Next": "ReturnNullState",
  12. "Input": [
  13. {
  14. "fooInput": "$.[a]"
  15. }
  16. ],
  17. "Output": {
  18. "fooResult": "$.#root"
  19. }
  20. },
  21. "ReturnNullState": {
  22. "Type": "ServiceTask",
  23. "ServiceName": "demoService",
  24. "ServiceMethod": "foo",
  25. "Next": "ChoiceState",
  26. "Status": {
  27. "$Exception{io.seata.saga.engine.mock.DemoException}": "UN",
  28. "$Exception{java.lang.Exception}": "FA",
  29. "#root != null && #root.size() > 0": "SU",
  30. "#root == null || #root.size() == 0": "FA"
  31. }
  32. },
  33. "ChoiceState":{
  34. "Type": "Choice",
  35. "Choices":[
  36. {
  37. "Expression":"[a] == 1",
  38. "Next":"SecondState"
  39. },
  40. {
  41. "Expression":"[a] == 2",
  42. "Next":"ThirdState"
  43. }
  44. ],
  45. "Default":"Fail"
  46. },
  47. "SecondState": {
  48. "Type": "ServiceTask",
  49. "ServiceName": "demoService",
  50. "ServiceMethod": "bar",
  51. "Input": [
  52. {
  53. "barInput": "$.[fooResult]",
  54. "throwException": "$.[barThrowException]"
  55. }
  56. ],
  57. "Output": {
  58. "barResult": "$.#root"
  59. },
  60. "Status": {
  61. "$Exception{io.seata.saga.engine.mock.DemoException}": "UN",
  62. "$Exception{java.lang.Exception}": "FA",
  63. "#root != null && #root.size() > 0": "SU",
  64. "#root == null || #root.size() == 0": "FA"
  65. },
  66. "Catch": [
  67. {
  68. "Exceptions": [
  69. "io.seata.saga.engine.mock.DemoException"
  70. ],
  71. "Next": "Fail"
  72. }
  73. ],
  74. "Next": "Succeed"
  75. },
  76. "ThirdState": {
  77. "Type": "ServiceTask",
  78. "ServiceName": "demoService",
  79. "ServiceMethod": "foo",
  80. "Input": [
  81. {
  82. "fooInput": "$.[fooResult]"
  83. }
  84. ],
  85. "Output": {
  86. "fooResult": "$.#root"
  87. },
  88. "Next": "Succeed"
  89. },
  90. "Succeed": {
  91. "Type":"Succeed"
  92. },
  93. "Fail": {
  94. "Type":"Fail",
  95. "ErrorCode": "NOT_FOUND",
  96. "Message": "not found"
  97. }
  98. }
  99. }