merlimat commented on a change in pull request #2266: Integrate functions and 
io with schema registry
URL: https://github.com/apache/incubator-pulsar/pull/2266#discussion_r206340627
 
 

 ##########
 File path: 
pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/TopicSchema.java
 ##########
 @@ -0,0 +1,195 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.functions.source;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pulsar.client.api.PulsarClient;
+import org.apache.pulsar.client.api.Schema;
+import org.apache.pulsar.client.impl.PulsarClientImpl;
+import org.apache.pulsar.client.impl.schema.AvroSchema;
+import org.apache.pulsar.client.impl.schema.JSONSchema;
+import org.apache.pulsar.client.impl.schema.ProtobufSchema;
+import org.apache.pulsar.common.schema.SchemaInfo;
+import org.apache.pulsar.common.schema.SchemaType;
+import org.apache.pulsar.functions.api.SerDe;
+import org.apache.pulsar.functions.instance.InstanceUtils;
+
+public class TopicSchema {
+
+    private final Map<String, Schema<?>> cachedSchemas = new HashMap<>();
+    private final PulsarClient client;
+
+    public TopicSchema(PulsarClient client) {
+        this.client = client;
+    }
+
+    /**
+     * If there is no other information available, use JSON as default schema 
type
+     */
+    private static final SchemaType DEFAULT_SCHEMA_TYPE = SchemaType.JSON;
+
+    public static final String DEFAULT_SERDE = 
"org.apache.pulsar.functions.api.utils.DefaultSerDe";
 
 Review comment:
   The problem is that you still might have functions created with this config, 
or older clients still submitting function with default serde.
   
   The class is gone, though the class name is used to fallback to the 
"default" schema.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to