Follow along with the Tutorial Video. It is part of your Hands-on Exercise.
We introduced the Java Admin APIs.
In pom.xml, link cluster_admin to sn_training.admin_tasks.ClusterAdmin.
<execution>
<id>cluster_admin</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>sn_training.admin_tasks.ClusterAdmin</mainClass>
</configuration>
</execution>
To view the schema of a topic, we use pulsarAdmin.schemas().getSchemaInfo(topic).
SchemaInfo si = null;
try{
si = pulsarAdmin.schemas().getSchemaInfo(topic);
} catch (PulsarAdminException e) {
e.printStackTrace();
}
System.out.println("Schema info: " + si);
To delete the schema of a topic, we use pulsarAdmin.schemas().deleteSchema(topic).
String topic = "persistent://student31/developer/order_approved";
try{
pulsarAdmin.schemas().deleteSchema(topic);
} catch (PulsarAdminException e) {
e.printStackTrace();
}
We deleted the registered schema for both orderBackLogChina and orderBackLogUS and confirmed OrderProducer is now able to write messages to the server with Schema Order.
Note: order_approved and order_declined still have a registered schema of String.
Note: there are still String messagesĀ in our topics.