GitHub user BewareMyPower added a comment to the discussion: [Bug] Pulsar 
Client ignores producer schema

> In the failed message produce, the data -m '{"family" : "genus" }' should 
> have been rejected, 

The schema validation only happens when the producer connects to the broker. 
When the producer sends a message with wrong format, the message could still be 
sent successfully. If you want to validate the schema when sending messages, 
you should create an `AUTO_PRODUCE` producer. See 
https://pulsar.apache.org/docs/2.11.x/schema-understand/#auto-schema

It seems that the Pulsar CLI cannot create an `AUTO_PRODUCE` producer currently.

BTW, `isSchemaValidationEnforced` only enforces the schema validation for bytes 
producer. i.e. a bytes producer cannot connect to a topic that already has 
schema, if users want to send messages via raw bytes, they have to create an 
`AUTO_PRODUCE` producer.

GitHub link: 
https://github.com/apache/pulsar/discussions/20586#discussioncomment-6187223

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to