Avro4k - Exception: Not a named type: "int"

33 Views Asked by At

Class:

@Serializable
data class User1(
    val id: Int,
    val name: String
)

Method:

val user = User1(1, "User")
val avroData = Avro.default.toRecord(User1.serializer(), user)
sender2.sendMessage(avroData).getOrThrow()

I get this exception when I want to send Avro Record from avro4k to Azure service bus.

com.digitalchargingsolutions.middleware.servicebus.client.exception.ServiceBusClientException: Not a named type: "int" (through reference chain: com.github.avrokotlin.avro4k.ListRecord["s"]->org.apache.avro.Schema$RecordSchema["fields"]->org.apache.avro.Schema$LockableArrayList[0]->org.apache.avro.Schema$Field["schema"]->org.apache.avro.Schema$IntSchema["aliases"])

If I send ByteArray all works fine but when I want to send GenericRecord I get the exception.

I try with @AvroAlias but it doesn't work.

0

There are 0 best solutions below