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

Schema Registry Support #156

Closed
juanpedromoreno opened this issue Jan 30, 2018 · 7 comments
Closed

Schema Registry Support #156

juanpedromoreno opened this issue Jan 30, 2018 · 7 comments
Labels
enhancement New feature or request

Comments

@juanpedromoreno
Copy link
Member

Currently, frees-rpc supports Avro serialization using avro4s. Ideally, it might be great if we support Avro serialization and, also schema versioning, allowing the evolution of schemas. One option would be addressing it by using the Schema Registry.

@L-Lavigne
Copy link
Contributor

For reference, here are the corresponding issues for avrohugger which is our implementation for Avro-schema sourcegen:

Schema downloads: julianpeeters/sbt-avrohugger#26
Schema uploads: julianpeeters/sbt-avrohugger#27 (most of the discussion and code samples are there)

There might be something there we can leverage.

@L-Lavigne
Copy link
Contributor

This sbt plugin could also be useful: https://github.com/iadvize/sbt-avro

@L-Lavigne L-Lavigne self-assigned this May 23, 2018
@L-Lavigne
Copy link
Contributor

L-Lavigne commented May 23, 2018

Quick note - regardless of API used, the Schema Registry only supports .avsc files which are individual class definitions (our @message classes).

Some of our users have .avdl or .avpr protocol files which contain multiple class definitions, as well as RPC services (our @rpc methods) which aren't definable in .avsc format and thus not storable in the registry. So in order to support those formats we'd need to break them apart into .avsc's (there are tools for this) before uploading them, minus their RPC's, to the Registry. (Same goes for validation against the registry.) If we support downloading in addition to validation, we'd then need to re-assemble them into .avdl's or .avpr's to which we would then add locally-defined RPC call definitions.

@L-Lavigne L-Lavigne added enhancement New feature or request sbt-plugin labels May 23, 2018
@L-Lavigne L-Lavigne removed their assignment Jun 4, 2018
@pirita
Copy link

pirita commented Jun 17, 2018

most of the work can be done with:

  • sbt-avro: Downloading/Uploading to schema-registry and conversions to case classes.

  • avro tools: It allow us to make conversions between .avdl (not the RPC methods) and .avsc.

We just need to separate the model definition and the RPC methods. I am to sure if it is possible, but If we don't want to add RPC local-definitions, we can make a module to convert an .avsc with RPC definitions to an .avsc without RPC definitions.

For example, we can convert:

  com.company.package.Apple getApple(com.company.package.Request request);

to

  record getAppleRPCMethod {
    string com_company_package_Apple;
    string name;
  }

  record getAppleRPCMethodParameters {
    string com_company_package_Request__ParamType1;
    string request__ParamName1;
  }

@L-Lavigne
Copy link
Contributor

Creating special records to represent RPC calls is an interesting idea! We could do this with a single record I think, and using the actual message record types as req/resp types instead of strings.

@pirita
Copy link

pirita commented Jun 20, 2018

It could work.

  record getAppleRPCMethod {
    com_company_package_Apple getApple;
    com.company.package.Request request;
  }

I think is worth to try if it is possible to have a way to convert from a .avdl (models and RPC definitions) to .avsc and and vice versa.

@L-Lavigne
Copy link
Contributor

Schema registry support (for Avro and more) will be implemented in the Compendium project: https://github.com/higherkindness/compendium.

@juanpedromoreno juanpedromoreno closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants