Git Product home page Git Product logo

Comments (5)

vanessapinto257 avatar vanessapinto257 commented on August 22, 2024

Hi,

Thanks for reaching out!
We do provide the ability to specify implementation of AwsCredentialsProvider as seen here and here for GlueSchemaRegistryKafkaSerializer.

Let me know if you have more questions.

from aws-glue-schema-registry.

rampaldheeraj avatar rampaldheeraj commented on August 22, 2024

Thanks for getting back @vanessapinto257 . Yes, I saw that and I utilise this constructor as shown above in the code snippet. The thing is that the the producer configuration only takes the class name of the Serialiser and not the object.

producerProperties.put( ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, GlueSchemaRegistryKafkaSerializer.class.getName());
And the kafka Library uses the default constructor to create the serialiser.

    /**
     * Constructor used by Kafka producer when passing as the property.
     */
    public GlueSchemaRegistryKafkaSerializer() {
        this(DefaultCredentialsProvider.builder()
                     .build(), null, null);
    }

This constructor when invoked call another constructor which initialises the AwsCredentialsProvider to DefaultCredentialsProvider .

    public GlueSchemaRegistryKafkaSerializer(AwsCredentialsProvider credentialProvider,
                                             UUID schemaVersionId,
                                             Map<String, ?> configs) {
        this.credentialProvider = (credentialProvider == null) ? DefaultCredentialsProvider.builder()
                .build() : credentialProvider;
        this.schemaVersionId = schemaVersionId;
        if (configs != null) {
            configure(configs, false);
        }
    }

I am looking for a way to specify the AwsCredentialsProvider without having to extend the GlueSchemaRegistryKafkaSerializer as I did . The code snippet is there on my question.

Regards
Dheeraj Rampal

from aws-glue-schema-registry.

blacktooth avatar blacktooth commented on August 22, 2024

Have you tried initializing your producer with serializers as arguments as show in the Kafka documentation?

Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("transactional.id", "my-transactional-id");

Producer<String, String> producer = new KafkaProducer<>(props, new StringSerializer(), new GlueSchemaRegistryKafkaSerializer(credentialProvider, configs));

from aws-glue-schema-registry.

rampaldheeraj avatar rampaldheeraj commented on August 22, 2024

Thanks for getting back. This will definitely work. However I am using spring-kafka which provides kafka-template, which can be initialised by providing an instance of ProducerFactory. At this moment I am occupied with some other assignment. I will try to find some time and do something similar to what you suggested with the ProducerFactory. I will get back to you.

from aws-glue-schema-registry.

blacktooth avatar blacktooth commented on August 22, 2024

Thank you! Please feel free to re-open if you run into issues trying it.

from aws-glue-schema-registry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.