tuteng opened a new issue #5503: [Schema]GenericData$Record cannot be cast URL: https://github.com/apache/pulsar/issues/5503 **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' ``` @Builder @Data @NoArgsConstructor @AllArgsConstructor public static class Foo2 { private String name; private Integer id; } PulsarClient client = PulsarClient.builder() .serviceUrl("pulsar://localhost:6650") .build(); AvroSchema<Foo2> schema = AvroSchema.of(SchemaDefinition.<Foo2>builder().withJsonDef("{\n" + " \"type\": \"record\",\n" + " \"name\": \"Test\",\n" + " \"fields\": [\n" + " {\n" + " \"name\": \"id\",\n" + " \"type\": [\n" + " \"null\",\n" + " \"int\"\n" + " ]\n" + " },\n" + " {\n" + " \"name\": \"name\",\n" + " \"type\": [\n" + " \"null\",\n" + " \"string\"\n" + " ]\n" + " }\n" + " ]\n" + " }").withPojo(Foo2.class).build()); Consumer<Foo2> consumer = client.newConsumer(schema) .topic("pulsar-mysql-jdbc-sink-topic") .subscriptionName("my-subscription-2") .subscribe(); while (true) { // Wait for a message Message<Foo2> msg = consumer.receive(); Foo2 f = msg.getValue(); } ``` 2. See error ``` Exception in thread "main" java.lang.ClassCastException: org.apache.pulsar.shade.org.apache.avro.generic.GenericData$Record cannot be cast to io.streamnative.KeyValueSchemaTest$Foo2 at io.streamnative.KeyValueSchemaTest.testConsumerByPythonProduce(KeyValueSchemaTest.java:412) at io.streamnative.KeyValueSchemaTest.main(KeyValueSchemaTest.java:305) ``` **Expected behavior** A clear and concise description of what you expected to happen. **Desktop (please complete the following information):** - OS: [e.g.Mac] **Additional context** Add any other context about the problem here.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
