@@ -379,16 +379,16 @@ In this mode, you must return results in the same order of your batch items, so
379
379
2. We use `post_id` as our unique identifier of the GraphQL request.
380
380
381
381
=== "getting_started_with_batch_resolver_payload.json"
382
- ```json hl_lines="4 16 21 29 41 46 "
382
+ ```json hl_lines="6 16 25 35 44 54 "
383
383
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload.json"
384
384
```
385
385
386
386
=== "getting_started_with_batch_query.graphql"
387
- ```typescript hl_lines="4 16 21 29 41 46 "
387
+ ```typescript hl_lines="3 6 "
388
388
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query.graphql"
389
389
```
390
390
391
- #### Processing items individually
391
+ ##### Processing items individually
392
392
393
393
``` mermaid
394
394
stateDiagram-v2
@@ -446,20 +446,20 @@ In this mode, we will:
446
446
* You can customize ` nul ` or error responses back to the client in the [ AppSync resolver mapping templates] ( https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html#returning-individual-errors ) {target="_ blank"}
447
447
448
448
=== "getting_started_with_batch_resolver_individual.py"
449
- ```python hl_lines="3 7 17 "
449
+ ```python hl_lines="5 9 19 "
450
450
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_individual.py"
451
451
```
452
452
453
453
1. You need to disable the aggregated event by using `aggregate` flag.
454
454
The resolver receives and processes each record one at a time.
455
455
456
456
=== "getting_started_with_batch_resolver_payload.json"
457
- ```json hl_lines="4 16 21 29 41 46 "
457
+ ```json hl_lines="6 16 25 35 44 54 "
458
458
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload.json"
459
459
```
460
460
461
461
=== "getting_started_with_batch_query.graphql"
462
- ```typescript hl_lines="4 16 21 29 41 46 "
462
+ ```typescript hl_lines="3 6 "
463
463
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query.graphql"
464
464
```
465
465
@@ -520,38 +520,40 @@ You can toggle `raise_on_error` parameter in `@batch_resolver` to propagate any
520
520
This is useful when you want to stop processing immediately in the event of an unhandled or unrecoverable exception.
521
521
522
522
=== "getting_started_with_batch_resolver_handling_error.py"
523
- ```python hl_lines="3 7 17 "
523
+ ```python hl_lines="5 9 19 "
524
524
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_handling_error.py"
525
525
```
526
526
527
527
1. You can enable enable the error handling by using `raise_on_error` flag.
528
528
529
529
=== "getting_started_with_batch_resolver_payload.json"
530
- ```json hl_lines="4 16 21 29 41 46 "
530
+ ```json hl_lines="6 16 25 35 44 54 "
531
531
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload.json"
532
532
```
533
533
534
534
=== "getting_started_with_batch_query.graphql"
535
- ```typescript hl_lines="4 16 21 29 41 46 "
535
+ ```typescript hl_lines="3 6 "
536
536
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query.graphql"
537
537
```
538
538
539
- #### Async
539
+ #### Async batch resolver
540
540
541
541
Similar to ` @batch_resolver ` explained in [ batch resolvers] ( #batch-resolvers ) , you can use ` async_batch_resolver ` to handle async functions.
542
542
543
543
=== "getting_started_with_batch_async_resolver.py"
544
- ```python hl_lines="3 7 17 "
544
+ ```python hl_lines="5 9 23 "
545
545
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_async_resolver.py"
546
546
```
547
547
548
- === "getting_started_with_batch_async_resolver_payload.json"
549
- ```json hl_lines="4 16 21 29 41 46"
550
- --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_async_resolver_payload.json"
548
+ 1. `async_batch_resolver` takes care of running and waiting for coroutine completion.
549
+
550
+ === "getting_started_with_batch_resolver_payload.json"
551
+ ```json hl_lines="6 16 25 35 44 54"
552
+ --8<-- "examples/event_handler_graphql/src/getting_started_with_batch_resolver_payload.json"
551
553
```
552
554
553
555
=== "getting_started_with_batch_query.graphql"
554
- ```typescript hl_lines="4 16 21 29 41 46 "
556
+ ```typescript hl_lines="3 6 "
555
557
--8<-- "examples/event_handler_graphql/src/getting_started_with_batch_query.graphql"
556
558
```
557
559
0 commit comments