momo-jun commented on a change in pull request #13832: URL: https://github.com/apache/pulsar/pull/13832#discussion_r795026590
########## File path: site2/docs/schema-manage.md ########## @@ -809,17 +809,118 @@ To use your custom schema storage implementation, perform the following steps. ## Set schema compatibility check strategy -You can set [schema compatibility check strategy](schema-evolution-compatibility.md#schema-compatibility-check-strategy) at namespace or broker level. +You can set [schema compatibility check strategy](schema-evolution-compatibility.md#schema-compatibility-check-strategy) at the topic, namespace or broker level. -- If you set schema compatibility check strategy at both namespace or broker level, it uses the strategy set for the namespace level. +The schema compatibility check strategy set at different levels has priority: topic level > namespace level > broker level. -- If you do not set schema compatibility check strategy at both namespace or broker level, it uses the `FULL` strategy. +- If you set the strategy at both topic and namespace level, it uses the topic-level strategy. -- If you set schema compatibility check strategy at broker level rather than namespace level, it uses the strategy set for the broker level. +- If you set the strategy at both namespace and broker level, it uses the namespace-level strategy. -- If you set schema compatibility check strategy at namespace level rather than broker level, it uses the strategy set for the namespace level. +- If you do not set the strategy at any level, it uses the `FULL` strategy. -### Namespace + +### Topic level + +To set a schema compatibility check strategy at the topic level, use one of the following methods. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--admin CLI--> + +Use the [`pulsar-admin topics set-schema-compatibility-strategy`](https://pulsar.apache.org/tools/pulsar-admin/) command. + +```shell +pulsar-admin topics set-schema-compatibility-strategy <strategy> <topicName> +``` +<!--REST API--> + +Send a `PUT` request to this endpoint: {@inject: endpoint|PUT|/admin/v2/topics/:tenant/:namespace/:topic|operation/schemaCompatibilityStrategy?version=[[pulsar:version_number]]} + +<!--Java Admin API--> + +```java +void setSchemaCompatibilityStrategy(String topic, SchemaCompatibilityStrategy strategy) +``` + +Here is an example of setting a schema compatibility check strategy at the topic level. + +```java +PulsarAdmin admin = …; + +admin.topicPolicies().setSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", SchemaCompatibilityStrategy.ALWAYS_INCOMPATIBLE); +``` + +<!--END_DOCUSAURUS_CODE_TABS--> +<br /> +To get the topic-level schema compatibility check strategy, use one of the following methods. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--admin CLI--> + +Use the [`pulsar-admin topics get-schema-compatibility-strategy`](https://pulsar.apache.org/tools/pulsar-admin/) command. + +```shell +pulsar-admin topics get-schema-compatibility-strategy <topicName> +``` +<!--REST API--> + +Send a `GET` request to this endpoint: {@inject: endpoint|GET|/admin/v2/topics/:tenant/:namespace/:topic|operation/schemaCompatibilityStrategy?version=[[pulsar:version_number]]} + +<!--Java Admin API--> + +```java +SchemaCompatibilityStrategy getSchemaCompatibilityStrategy(String topic, boolean applied) +``` + +Here is an example of getting the topic-level schema compatibility check strategy. + +```java +PulsarAdmin admin = …; + +// get the current applied schema compatibility strategy +admin.topicPolicies().getSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", true); + +// only get the schema compatibility strategy from topic policies +admin.topicPolicies().getSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", false); +``` + +<!--END_DOCUSAURUS_CODE_TABS--> +<br /> +To remove the topic-level schema compatibility check strategy, use one of the following methods. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--admin CLI--> + +Use the [`pulsar-admin topics remove-schema-compatibility-strategy`](https://pulsar.apache.org/tools/pulsar-admin/) command. + +```shell +pulsar-admin topics remove-schema-compatibility-strategy <topicName> +``` +<!--REST API--> + +Send a `DELETE` request to this endpoint: {@inject: endpoint|DELETE|/admin/v2/topics/:tenant/:namespace/:topic|operation/schemaCompatibilityStrategy?version=[[pulsar:version_number]]} + +<!--Java Admin API--> + +```java +void removeSchemaCompatibilityStrategy(String topic) +``` + +Here is an example of removing the topic-level schema compatibility check strategy. + +```java +PulsarAdmin admin = …; + +admin.removeSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic"); +``` + +<!--END_DOCUSAURUS_CODE_TABS--> + + +### Namespace level Review comment: > We should keep the `DOCUSAURUS_CODE_TABS` tab has same style between Topice level and Namespace level. Do you mean by using the same tab name, like Admin CLI? -- 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]
