Skip to content

Commit b3e1f5f

Browse files
author
Leon Michalski
committed
Update readme example
1 parent 9ff10bb commit b3e1f5f

File tree

1 file changed

+11
-5
lines changed
  • packages/aws-cdk-lib/aws-stepfunctions

1 file changed

+11
-5
lines changed

packages/aws-cdk-lib/aws-stepfunctions/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -843,16 +843,22 @@ map.itemProcessor(definition);
843843
When using `JSONata`, the `itemSelector` property in a Map state can be specified in one of two ways. You can provide a valid JSON object containing JSONata expressions for each value:
844844

845845
```ts
846-
itemSelector: {
847-
id: '{% $states.context.Map.Item.Value.id %}',
848-
status: '{% $states.context.Map.Item.Value.status %}',
849-
}
846+
const map = new sfn.Map(this, 'Map State', {
847+
maxConcurrency: 1,
848+
itemSelector: {
849+
id: '{% $states.context.Map.Item.Value.id %}',
850+
status: '{% $states.context.Map.Item.Value.status %}',
851+
}
852+
});
850853
```
851854

852855
Alternatively, you can use the `jsonataItemSelector` field to directly supply a JSONata string that evaluates to a complete JSON object:
853856

854857
```ts
855-
jsonataItemSelector: '{% {\"id\": $states.input.id, \"status\": $states.input.status} %}'
858+
const map = new sfn.Map(this, 'Map State', {
859+
maxConcurrency: 1,
860+
jsonataItemSelector: '{% {\"id\": $states.input.id, \"status\": $states.input.status} %}'
861+
});
856862
```
857863

858864
To define a distributed `Map` state set `itemProcessors` mode to `ProcessorMode.DISTRIBUTED`.

0 commit comments

Comments
 (0)