I have an Avro scheme, something like:
{
"type": "record",
"name": "NotificationEventAvro",
"namespace": "io.company.project1.dto.event",
"fields": [
{ "name": "topic", "type": "string" },
{ "name": "payload", "type": "string" },
{ "name": "createdAt", "type": "long", "logicalType": "timestamp-millis" },
{ "name": "url", "type": "string" },
{ "name": "eventId", "type": "string", "logicalType": "uuid" }
]
}
When I use the scheme in the second project, I write something like:
{
"type": "record",
"name": "NotificationEventAvro",
"namespace": "io.company.project2.dto.event",
"fields": [
{ "name": "topic", "type": "string" },
{ "name": "payload", "type": "string" },
{ "name": "createdAt", "type": "long", "logicalType": "timestamp-millis" },
{ "name": "url", "type": "string" },
{ "name": "eventId", "type": "string", "logicalType": "uuid" }
]
}
Notice the namespaces (classpaths) are different.
How to use Avro scheme in the proper way?
Event DTOs in both projects are the same, just classpaths are different, so when consumer asks the scheme from schema-registry it sends the scheme with namespace (classpath) of another project, so consumer can not find the class.
How to deal with this?