We are excited to announce a new integration for Event Handler to work with AWS AppSync Events APIs. This utility provides a structured way to handle AppSync real-time events through dedicated handler methods, automatic routing, and flexible configuration options.
Our Event Handler REST API now supports customizable HTTP error codes per route. Thanks for this contribution @amin-farjadi.
Additionally, our Data masking utility now supports a broader range of types including Pydantic models, dataclasses, and standard Python classes - an outstanding contribution from @VatsalGoel3.
β Huge thanks to @GuidoNebiolo, @kazu728, @victorperezpiqueras, and @konokenj for their contributions in this release.
New Event Handler for AppSync Events featureThe new AppSyncEventsResolver is designed to streamline working with AWS AppSync real-time APIs by:
You can register handlers for publish events using @app.on_publish()
to process and validate messages before they're broadcasted to subscribers. This is useful to modify payload content, apply business logic, and reject messages when needed.
You can use @app.on_subscribe()
to handle subscription requests before allowing clients to listen to specific channels. This enables authorization checks and subscription filtering based on client context or payload attributes, s well as subscription tracking, for example.
You can use the parameter aggregate=True
to process multiple events together as a batch. This is useful when you need to optimize database operations, or want to have full control over how the messages are processed, for example.
Q: Can I handle different types of events from the same channel?
A: Yes, you can register different handlers for publish and subscribe events on the same channel.
Q: How does handler precedence work with wildcard patterns?
A: More specific patterns take precedence over wildcards. For example, /default/channel1
will be chosen over /default/*
, which will be chosen over /*
.
Q: What happens when an exception occurs in my handler?
A: With individual processing (aggregate=False
), the utility catches exceptions and includes them in the response for the specific event while still processing other events. You can also explicitly raise an UnauthorizedException
exception to reject the entire request.
Q: Can I process events asynchronously?
A: Yes, use the @app.async_on_publish()
decorator for asynchronous processing of events.
Q: Does the order of async event processing matter?
A: No, AppSync Events doesn't guarantee delivery order. As long as each response includes the original event ID, AppSync processes them correctly regardless of order.
Q: Can I process multiple events as a batch?
A: Yes, set aggregate=True
to receive all matching events as a batch in your handler.
ruff format
(#6512) by @leandrodamascenaopenapi_extensions
in BedrockAgentResolver (#6510) by @leandrodamascena@GuidoNebiolo, @VatsalGoel3, @Weugene, @amin-farjadi, @anafalcao, @dependabot[bot], @github-actions[bot], @kazu728, @konokenj, @leandrodamascena, @victorperezpiqueras, dependabot[bot] and github-actions[bot]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4