You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/event_handler/appsync_events.md
+28-10Lines changed: 28 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ You must have an existing AppSync Events API with real-time capabilities enabled
59
59
60
60
=== "Getting started with AppSync Events"
61
61
62
-
```yaml hl_lines="5 10 12"
62
+
```yaml
63
63
Resources:
64
64
WebsocketAPI:
65
65
Type: AWS::AppSync::Api
@@ -95,7 +95,7 @@ AppSync Events uses a specific event format for Lambda requests and responses. I
95
95
96
96
=== "AppSync payload request"
97
97
98
-
```json"
98
+
```json
99
99
{
100
100
"identity":"None",
101
101
"result":"None",
@@ -171,7 +171,7 @@ AppSync Events uses a specific event format for Lambda requests and responses. I
171
171
172
172
=== "AppSync payload response"
173
173
174
-
```json"
174
+
```json
175
175
{
176
176
"events":[
177
177
{
@@ -191,9 +191,9 @@ AppSync Events uses a specific event format for Lambda requests and responses. I
191
191
192
192
```
193
193
194
-
=== "AppSync payload response with error
194
+
=== "AppSync payload response with error"
195
195
196
-
```json"
196
+
```json
197
197
{
198
198
"events":[
199
199
{
@@ -221,9 +221,9 @@ When processing events with Lambda, you can return errors to AppSync in three wa
221
221
### Resolver
222
222
223
223
???+ important
224
-
The event handler automatically parses the incoming event data and invokes the appropriate handler based on the namespace/channel pattern you register.
224
+
When you return `Resolve` or `ResolveAsync` from your handler it will automatically parse the incoming event data and invokes the appropriate handler based on the namespace/channel pattern you register.
225
225
226
-
You can define your handlers for different event types using the `OnPublish()`, `OnPublishAggregate()`, and `OnSubscribe()` methods and their `Async` versions.
226
+
You can define your handlers for different event types using the `OnPublish()`, `OnPublishAggregate()`, and `OnSubscribe()` methods and their `Async` versions `OnPublishAsync()`, `OnPublishAggregateAsync()`, and `OnSubscribeAsync()`.
227
227
228
228
=== "Publish events - Class library handler"
229
229
@@ -334,7 +334,7 @@ When an event matches with multiple handlers, the most specific pattern takes pr
334
334
### Aggregated processing
335
335
336
336
???+ note "Aggregate Processing"
337
-
`OnPublishAggregate()`, receives a list of all events, requiring you to manage the response format. Ensure your response includes results for each event in the expected [AppSync Request and Response Format](#appsync-request-and-response-format).
337
+
`OnPublishAggregate()` and `OnPublishAggregateAsync()`, receives a list of all events, requiring you to manage the response format. Ensure your response includes results for each event in the expected [AppSync Request and Response Format](#appsync-request-and-response-format).
338
338
339
339
In some scenarios, you might want to process all events for a channel as a batch rather than individually. This is useful when you need to:
340
340
@@ -376,7 +376,7 @@ You can filter or reject events by raising exceptions in your resolvers or by fo
376
376
377
377
#### Handling errors with individual items
378
378
379
-
When processing items individually with `OnPublish()`, you can raise an exception to fail a specific item. When an exception is raised, the Event Handler will catch it and include the exception name and message in the response.
379
+
When processing items individually with `OnPublish()` and `OnPublishAsync()`, you can raise an exception to fail a specific item. When an exception is raised, the Event Handler will catch it and include the exception name and message in the response.
380
380
381
381
=== "Error handling individual items"
382
382
@@ -387,6 +387,15 @@ When processing items individually with `OnPublish()`, you can raise an exceptio
@@ -408,7 +417,7 @@ When processing items individually with `OnPublish()`, you can raise an exceptio
408
417
409
418
#### Handling errors with batch of items
410
419
411
-
When processing batch of items with `OnPublishAggregate()`, you must format the payload according the expected response.
420
+
When processing batch of items with `OnPublishAggregate()` and `OnPublishAggregateAsync()`, you must format the payload according the expected response.
412
421
413
422
=== "Error handling batch items"
414
423
@@ -419,6 +428,15 @@ When processing batch of items with `OnPublishAggregate()`, you must format the
0 commit comments