Skip to content

v3.11.0

Compare
Choose a tag to compare
@github-actions github-actions released this 25 Apr 15:27
· 48 commits to refs/heads/develop since this release

Summary

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 feature

Docs

The new AppSyncEventsResolver is designed to streamline working with AWS AppSync real-time APIs by:

  • Handling publish and subscribe events with dedicated handler methods
  • Routing events automatically based on namespace and channel patterns
  • Supporting wildcard patterns for catch-all handlers
  • Processing events in parallel (async) or sequentially
  • Controlling event aggregation for batch processing
  • Implementing graceful error handling

Working with publish events

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.

publish

Working with subscribe events

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.

subscribe

Working with aggregated processing

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.

aggregate

AppSync Events FAQs

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.

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(parser): make key attribute optional in Kafka model (#6523) by @Weugene
  • fix(logger): warn customers when the ALC log level is less verbose than log buffer (#6509) by @anafalcao

🔧 Maintenance

This release was made possible by the following contributors:

@GuidoNebiolo, @VatsalGoel3, @Weugene, @amin-farjadi, @anafalcao, @dependabot[bot], @github-actions[bot], @kazu728, @konokenj, @leandrodamascena, @victorperezpiqueras, dependabot[bot] and github-actions[bot]