AbsaOSS / ABRiS

Avro SerDe for Apache Spark structured APIs.
Apache License 2.0
227 stars 73 forks source link

Schema Registry Requires API key #279

Open AlexanderBMNdeprecated opened 2 years ago

AlexanderBMNdeprecated commented 2 years ago

Hello there,

I am currently implementing a Confluent-Kafka stream on a managed cluster called Hopsworks. They provide an integrated Schema Registry that requires an API key to access the Schema Registry. When implementing the Confluent-Kafka without spark or abris integration, it looks like this: image

Now i want to use abris to make it work with spark structured streaming, but i can't figure out how to add the API key required to the abris config. Can you maybe help me out there?

Kind Regards

cerveada commented 2 years ago

There is no single config that would set the header for you in Abris, but there is a config to use a custom client implementation, where this should be possible.

Confluent's CachedSchemaRegistryClient has httpHeaders as constructor parameter.

In Abris look at SchemaManagerFactory there is a code that will look for REGISTRY_CLIENT_CLASS and instantiate it. You will have to implement AbrisRegistryClient trait and set the class name as a value for REGISTRY_CLIENT_CLASS key in the config.

The implementation should be very similar to ConfluentRegistryClient with just the headers added in the constructor.