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 for kafka.pubsub component #3144

Closed
passuied opened this issue Sep 20, 2023 · 6 comments
Closed

Schema registry support for kafka.pubsub component #3144

passuied opened this issue Sep 20, 2023 · 6 comments
Assignees
Labels
help wanted Extra attention is needed kind/enhancement New feature or request
Milestone

Comments

@passuied
Copy link
Contributor

passuied commented Sep 20, 2023

Describe the feature

New to DAPR and really eager to leverage it at my company. I was surprised that there is no Schema registry support or Avro/protobuf serialization in the kafka.pubsub component.
Is this on the roadmap?
The way it could work is enabling configuring schema registry URL/Authentication.
You could add metadata to the subscription to add specific overrides (e.g. schema name)

Release Note

RELEASE NOTE: ADD New feature in Dapr.

@passuied passuied added the kind/enhancement New feature or request label Sep 20, 2023
@passuied
Copy link
Contributor Author

Seems there was a mention in #8 (comment) but the issue was never created...

@berndverst
Copy link
Member

It's not supported or on the roadmap, but we will accept contributions for this!

@berndverst berndverst added the help wanted Extra attention is needed label Sep 21, 2023
@passuied
Copy link
Contributor Author

So updating this issue with findings.
This work is not trivial as the current sarama Kafka Go implementation doesn't support Schema registry...
Based on convo with @berndverst, we cannot switch to the Confluent Kafka client as it's leveraging a C library librdkafka and C bindings are not allowed in Dapr.
So the solution might be to re-implement the kafka.pubsub component as a pluggable component, which doesn't have the same limitations...
Doesn't seem trivial either but maybe easier?

@passuied
Copy link
Contributor Author

Hi, so getting ready to help on this issue. I'm looking into adding Schema Registry to the kafka-pubsub component by using the https://github.com/riferrei/srclient library. I'm not experienced in Go but it seems to be pure Go and therefore compatible.
Worst case scenario I could just re-implement the SchemaRegistryClient and leverage the underlying github.com/linkedin/goavro/v2 library for serialization/deserialization.
I would focus on avro first, since this is our use case.

In terms of interface, I would:

  • Add the following settings to the component:
    • schemaRegistryUrl: Schema Registry URL
    • schemaRegistryApiKey: Schema Registry credentials API Key
    • schemaRegitryApiSecret: Schema Registry credentials API Secret
    • autoRegisterSchemas: Whether the schema will get auto registered if missing upon publishing (default=True)
  • Add the following metadata to the subscription metadata
    • valueSchemaType: Schema Type for value (None, AVRO only for now)

So a subscription would look something like this:

{'pubsubname': 'pubsub',
                      'topic': 'deathStarStatus',
                      'route': 'dsstatus',
                      'metadata': {
                          'valueSchemaType': 'AVRO'
                      } }

Assumptions:

  • This will NOT be compatible with CloudEvents as while There is a Cloud Event Avro version, Schema Registry doesn't support dynamic types, so the data node will not be able to be passed -- apart from a string, negating any of the schema benefits...

Would love some feedback on the above @berndverst and others

@passuied
Copy link
Contributor Author

@ItalyPaleAle @yaron2 should this issue receive the 1.13 label?
I want to make sure it's included in upcoming version. I assume it will automatically be but just in case...

@ItalyPaleAle ItalyPaleAle added this to the v1.13 milestone Jan 23, 2024
@ItalyPaleAle
Copy link
Contributor

@ItalyPaleAle @yaron2 should this issue receive the 1.13 label? I want to make sure it's included in upcoming version. I assume it will automatically be but just in case...

Added. We do go through all PRs as part of the final hygiene however, and add labels as needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed kind/enhancement New feature or request
Projects
No open projects
Development

No branches or pull requests

3 participants