Skip to content

Commit 6973d36

Browse files
committed
doc updates
1 parent c8db823 commit 6973d36

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

docs/core/event_handler/appsync_events.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ You must have an existing AppSync Events API with real-time capabilities enabled
5959

6060
=== "Getting started with AppSync Events"
6161

62-
```yaml hl_lines="5 10 12"
62+
```yaml
6363
Resources:
6464
WebsocketAPI:
6565
Type: AWS::AppSync::Api
@@ -95,7 +95,7 @@ AppSync Events uses a specific event format for Lambda requests and responses. I
9595

9696
=== "AppSync payload request"
9797

98-
```json"
98+
```json
9999
{
100100
"identity":"None",
101101
"result":"None",
@@ -171,7 +171,7 @@ AppSync Events uses a specific event format for Lambda requests and responses. I
171171

172172
=== "AppSync payload response"
173173

174-
```json"
174+
```json
175175
{
176176
"events":[
177177
{
@@ -191,9 +191,9 @@ AppSync Events uses a specific event format for Lambda requests and responses. I
191191

192192
```
193193

194-
=== "AppSync payload response with error
194+
=== "AppSync payload response with error"
195195

196-
```json"
196+
```json
197197
{
198198
"events":[
199199
{
@@ -221,9 +221,9 @@ When processing events with Lambda, you can return errors to AppSync in three wa
221221
### Resolver
222222

223223
???+ 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.
225225

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()`.
227227

228228
=== "Publish events - Class library handler"
229229

@@ -334,7 +334,7 @@ When an event matches with multiple handlers, the most specific pattern takes pr
334334
### Aggregated processing
335335

336336
???+ 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).
338338

339339
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:
340340

@@ -376,7 +376,7 @@ You can filter or reject events by raising exceptions in your resolvers or by fo
376376

377377
#### Handling errors with individual items
378378

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.
380380

381381
=== "Error handling individual items"
382382

@@ -387,6 +387,15 @@ When processing items individually with `OnPublish()`, you can raise an exceptio
387387
});
388388
```
389389

390+
=== "Error handling individual items Async"
391+
392+
```csharp
393+
app.OnPublishAsync("/default/channel", async (payload) =>
394+
{
395+
throw new Exception("My custom exception");
396+
});
397+
```
398+
390399
=== "Error handling individual items response"
391400

392401
```json hl_lines="4"
@@ -408,7 +417,7 @@ When processing items individually with `OnPublish()`, you can raise an exceptio
408417

409418
#### Handling errors with batch of items
410419

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.
412421

413422
=== "Error handling batch items"
414423

@@ -419,6 +428,15 @@ When processing batch of items with `OnPublishAggregate()`, you must format the
419428
});
420429
```
421430

431+
=== "Error handling batch items Async"
432+
433+
```csharp
434+
app.OnPublishAggregateAsync("/default/channel", async (payload) =>
435+
{
436+
throw new Exception("My custom exception");
437+
});
438+
```
439+
422440
=== "Error handling batch items response"
423441

424442
```json

0 commit comments

Comments
 (0)