如何使用Java通过Inputpath()方法(对象或参数)将输入传递到AWS状态机的状态

时间:2019-04-03 21:10:06

标签: amazon-web-services aws-step-functions

我想使用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 ;

    }

0 个答案:

没有答案