question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KafkaProducer is not getting the artifact version defined by `apicurio.registry.artifact.version` property

See original GitHub issue

My application uses a defined version of artifact already registered in Apicurio Registry, however the producer fails with the following exception:

Caused by: io.apicurio.registry.rest.client.exception.ArtifactNotFoundException: No artifact with ID 'Message' in group 'io.jromanmartin.kafka.schema.avro' was found.

To achieve it, my KakfaProducer is configured with the following property:

props.putIfAbsent(SerdeConfig.AUTO_REGISTER_ARTIFACT, false);
props.putIfAbsent(SerdeConfig.EXPLICIT_ARTIFACT_VERSION, "2.0");

The artifact was already registered using the apicurio-registry-maven-plugin plug-in as:

                    <plugin>
                        <groupId>io.apicurio</groupId>
                        <artifactId>apicurio-registry-maven-plugin</artifactId>
                        <version>${apicurio.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>register</goal>
                                </goals>
                                <configuration>
                                    <registryUrl>${apicurio.registry.url}</registryUrl>
                                    <artifacts>
                                        <artifact>
                                            <groupId>io.jromanmartin.kafka.schema.avro</groupId>
                                            <artifactId>Message</artifactId>
                                            <version>2.0</version>
                                            <type>AVRO</type>
                                            <file>
                                                ${project.basedir}/src/main/resources/schemas/message.avsc
                                            </file>
                                            <ifExists>RETURN_OR_UPDATE</ifExists>
                                            <canonicalize>true</canonicalize>
                                        </artifact>
                                    </artifacts>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

It seems that the client is not using the version declared to get the schema. The issue is very strange because describes that the artifact does not exist, when in the UI you get it. I can reproduce that issue using a valid version (already registered) or a non-registered version.

However if a request a version non-registered in the UI, I got the following issue:

http://service-registry.amq-streams-demo.apps-crc.testing/ui/artifacts/io.jromanmartin.kafka.schema.avro/Message/versions/1

io.apicurio.registry.storage.VersionNotFoundException: No version '1' found for artifact with ID 'Message' in group 'io.jromanmartin.kafka.schema.avro'.
	at io.apicurio.registry.storage.impl.sql.AbstractSqlRegistryStorage.getArtifactVersionMetaDataInternal(AbstractSqlRegistryStorage.java:1655)

Could be the client not using the same pattern to get the schema? Why in my application got the same error but in the UI I got the right exception?

Tested with Apicurio 2.0.1.Final.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
EricWittmanncommented, Jul 2, 2021

OK as expected this is a bug in the schema resolver config. The bug is here:

https://github.com/Apicurio/apicurio-registry/blob/master/serdes/serde-common/src/main/java/io/apicurio/registry/serde/AbstractSchemaResolver.java#L120-L127

Simple copy/paste bug. 😦

I’ll fix the code now but you would need to wait for a new release or build your own locally.

CC @famartinrh

0reactions
EricWittmanncommented, Jul 6, 2021

I don’t have a specific date for that yet. We may release a 2.0.2.Final or we may skip that and go directly for 2.1.0.Final. I’m leaning towards the former, in which case we could release something pretty soon (releases are cheap).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Validating Kafka messages using serializers/deserializers in ...
Define and register your schema with Apicurio Registry (if it does not already ... A group ID, artifact ID, and version represents a...
Read more >
Chapter 8. Configuring Kafka serializers/deserializers in Java ...
apicurio.registry.artifact.version. Used by serializers only. Sets the artifact version used for querying or creating an artifact. Overrides the version ...
Read more >
How to pass global id in kafka messages for apicurio registry ...
... io.apicurio.registry.utils.serde.strategy.TopicIdStrategy spring.kafka.producer.properties.apicurio.registry.artifact.version : "1" ...
Read more >
Apicurio - Jerome Boyer's Personal Site
As of Event Streams version 10.5, the schema registry was based on ... the Kafka message to an artifact ID in Apicurio Registry;...
Read more >
Using Apache Kafka with Schema Registry and Avro - Quarkus
We still have to define the apicurio.registry.auto-register property. If you use Confluent Schema Registry, you don't have to configure value.serializer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found