GitHub user nodece added a comment to the discussion: Cannot parse <null> schema

I did a test to reproduce this case:
```java
public class Main {
    public static void main(String[] args) throws Exception {
        var pulsarClient = 
PulsarClient.builder().serviceUrl("pulsar://localhost:6650").build();
        var topicName = "test-topic-" + System.currentTimeMillis();

        var producer1 = pulsarClient
                .newProducer(AvroSchema.of(MyPojo.class))
                .topic(topicName).create();
        producer1.send(new MyPojo());

        var consumer = pulsarClient
                .newConsumer(Schema.AVRO(MyPojo.class))
                .topic(topicName).subscriptionName("test")
                .subscriptionType(SubscriptionType.Shared)
                .subscriptionInitialPosition(SubscriptionInitialPosition.Latest)
                .subscribe();

        var producer2 = pulsarClient
                .newProducer(Schema.STRING)
                .topic(topicName).create();
        producer2.send("test2");

        var msg = consumer.receive();
        msg.getValue();   // 
org.apache.pulsar.shade.org.apache.avro.SchemaParseException: Cannot parse 
<null> schema
    }
}
```

We cannot use the old schema to decode the message with the latest schema. 

If you have such a scenario, we need to avoid this.

GitHub link: 
https://github.com/apache/pulsar/discussions/18948#discussioncomment-4414975

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@pulsar.apache.org

Reply via email to