Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document how to consume messages with a message schema #229

Open
pypingou opened this issue Oct 13, 2020 · 1 comment
Open

docs: document how to consume messages with a message schema #229

pypingou opened this issue Oct 13, 2020 · 1 comment

Comments

@pypingou
Copy link
Member

The current docs has examples and instructions on how to send messages using a message schema but not of consuming messages that have a schema.

How does a consumer know that a message it received follows a schema? How does it convert the base Message into a more specific object?

@jeremycline
Copy link
Member

All the standard Python object introspection interfaces should be sufficient. The consumer is called with an instance of the class that defines the schema, if it's installed. If it's not, it'll get a plain Message. Anything from isinstance to poking around in the attached jsonschema (although if you're doing this you probably shouldn't be) should work as you'd expect. I think it's fine to add a note to the consumer docs saying something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants