KafkaProducer is not getting the artifact version defined by `apicurio.registry.artifact.version` property
See original GitHub issueMy 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:
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:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
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
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).