我想使用inputpath
方法将输入对象作为inputpath
传递到状态机(使用Java构建)方法(lambda)的状态,然后执行计算机。但无法做到。当我将JSON字符串传递给inputpath
方法时,出现错误-
Exception in thread "main" com.amazonaws.services.stepfunctions.model.InvalidDefinitionException: Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: Value must be a valid JSONPath. at /States/choiceselector/InputPath' (Service: AWSStepFunctions; Status Code: 400; Error Code: InvalidDefinition; Request ID: 4e6436da-5d52-11e9-affc-d4r5554y64hfd)
我想通过inputPath
发送到状态机的输入在下面(人JSON /对象)
String personJSON = "{ "name": "alex", "city": "NY"}";
我也尝试了以下json格式-
"{\n \"name\": "alex",\n \"city\": 1106\n}"
,但仍然出现错误。
我的代码是-
StateMachine helloworldStateMachine = StateMachine.builder()
.comment("A Hello World example of the Amazon States Language using an AWS Lambda Function")
.startAt("choiceselector")
.state("choiceselector", TaskState.builder().resource("ARN of my plain java/lambda function").inputPath(personJSON) .transition(NextStateTransition.builder().nextStateName("GoToState"))) ... and so on
我的lambda / plain java方法如下->>
public StepOutput choice(Person person) {
System.out.println( " input param ***"+person.getName());
StepOutput so = new StepOutput();
so.setMessage("Hi -"+person.getName());
return so ;
}