jerrypeng commented on a change in pull request #4005: Set key for message when 
using function publish
URL: https://github.com/apache/pulsar/pull/4005#discussion_r275099436
 
 

 ##########
 File path: 
pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/Context.java
 ##########
 @@ -239,9 +239,30 @@
      * Publish an object to the topic using default schemas.
      *
      * @param topicName The name of the topic for publishing
-     * @param object The object that needs to be published
+     * @param object    The object that needs to be published
      * @return A future that completes when the framework is done publishing 
the message
      */
     <O> CompletableFuture<Void> publish(String topicName, O object);
 
+    /**
+     * Publish an object using serDe or schema class for serializing to the 
topic.
+     *
+     * @param topicName              The name of the topic for publishing
+     * @param object                 The object that needs to be published
+     * @param schemaOrSerdeClassName Either a builtin schema type (eg: "avro", 
"json", "protobuf") or the class name
+     *                               of the custom schema class
+     * @param messageConf      A map of configurations to set for the message 
that will be published
+     *                         The available options are:
+     *
+     *                         "key" - Parition Key
+     *                         "properties" - Map of properties
+     *                         "eventTime"
+     *                         "sequenceId"
+     *                         "replicationClusters"
+     *                         "disableReplication"
+     *
+     * @return A future that completes when the framework is done publishing 
the message
+     */
+    <O> CompletableFuture<Void> publish(String topicName, O object, String 
schemaOrSerdeClassName, Map<String, Object> messageConf);
 
 Review comment:
   I think we do some caching with schemaOrSerdeClassName so that we don't 
instantiate the schema/SerDe every single type.  And we use 
schemaOrSerdeClassName as the key for the cache.  Not greatest user experience 
but that is what is happening now

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to