How to use EventBridge code bindings for different event versions in Python?

0

I'm exploring EventBridge, Schema Registry and EventBridge Code bindings for Python. The events stored in the schema registry have a version identifier. I struggle to see how versions and code bindings are supposed to be used in a single code base, e.g. if the same code base handles multiple version of events. The marshaller in the code bindings is version specific. Do I need to create my own component for this?

2 Answers
0

Hi, thanks for reaching out!

Yeah, you're right that the code base you can obtain for a given schema version is specific to that version, and that the downloaded code base doesn't allow for specifying an alternate version of that schema when put to use.

Short of creating your own component, another approach would be to utilize multiple independent schemas for multiple schema variations of a particular event, and just maintain a single version of each of those independent schemas.

AWS
SUPPORT ENGINEER
answered a year ago
0

Hi there,

We have an API GetCodeBindingSource (https://docs.aws.amazon.com/eventbridge/latest/schema-reference/v1-registries-name-registryname-schemas-name-schemaname-language-language-source.html) that has a schemaVersion field that allows customers to select the code binding version they want. If you know which version of an event you want, you can use this API to get the relevant code binding.

The customer would need to build their custom solution for this though.

We have projects in our roadmap to better streamline this use case but at the moment the below is recommended.

  1. For minor backwards compatible schema changes to the schema If the changes are of this type that would means in theory the newer schema version should actually be usable to deserialize old events too, and then the customer can do runtime checks on the deserialized object to evaluate which version it's coming from.

  2. For non-backwards compatible breaking changes to the schema Our guidance today would be to actually use different Schemas, and different detail types. Then, they could use the detail type to pick the right schema and use the latest version of that schema.

AWS
SUPPORT ENGINEER
Sagar_T
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions