I have the below config of kafka
spring:
cloud:
stream:
bindings:
default:
content-type: application/*+avro
outputAddBankAccount:
destination: add_bank_account
group: bank-group
producer:
useNativeEncoding: true
kafka:
binder:
brokers: 127.0.0.1:9092
auto-create-topics: true
producer-properties:
acks: -1
retries: 2147483647
max.in.flight.requests.per.connection : 1
request.timeout.ms: 10000
key.serializer: org.apache.kafka.common.serialization.StringSerializer
value.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
schema.registry.url: https://schema-registry1:8081,https://schema-registry2:8081
basic.auth.credentials.source: USER_INFO
basic.auth.user.info: test:test
I generate the CreateBankAccount
using the plugin avro-maven-plugin
CreateBankAccount createBankAccount = CreateBankAccount.newBuilder()
.setExerciceFrameworkId(event.exerciceFrameworkId).setAgreementFileId(event.agreementFileId)
.setConventionCode(convention.getConventionCode()).build();
Then i pushed a message to the topic with a string key and an avro serialized payload, but i have an error
MessageChannel messageChannel = kafkaStreams.addBankAccount();
messageChannel.send(MessageBuilder.withPayload(createBankAccount)
.setHeader(KafkaHeaders.MESSAGE_KEY, UUID.randomUUID().toString()).build());
Caused by: org.apache.kafka.common.errors.SerializationException: Error registering Avro schema{"type":"record","name":"CreateBankAccount","namespace":"com.test.serviceprovider.avro","fields":[{"name":"exerciceFrameworkId","type":{"type":"string","avro.java.string":"String"}},{"name":"agreementFileId","type":{"type":"string","avro.java.string":"String"}},{"name":"conventionCode","type":{"type":"string","avro.java.string":"String"}}]}
> Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: User cannot access the resource; error code: 403