lhotari commented on PR #24663:
URL: https://github.com/apache/pulsar/pull/24663#issuecomment-3224286974

   I think I found an answer to the wrong schema instance when using 
`AUTO_PRODUCE_BYTES` with `message.getReaderSchema().get()` as the schema.
   
   
https://github.com/apache/pulsar/blob/1220951ac74fb4742abbbd331d6e751234c47015/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageImpl.java#L395-L413
   
   For example, for Avro messages, this maps finally here:
   
https://github.com/apache/pulsar/blob/3b7bef1ecaf4004f36e071faaf31ddb49895115c/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/reader/MultiVersionAvroReader.java#L53-L54
   
   It will always use the original Schema instance for reading and never 
refresh the "readerSchema" from the schema registry. This is why the mandatory 
validation before serializing the message to DLQ fails. Considering this fact, 
I think that that `AutoProduceBytesSchema.setRequireSchemaValidation(false)` is 
a very reasonable way to workaround this issue for the DLQ use case.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to