You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/28 18:18:42 UTC

[GitHub] [pulsar] dlg99 commented on a change in pull request #14475: KCA: Option to sanitize topic name for the connectors that cannot handle pulsar topic names

dlg99 commented on a change in pull request #14475:
URL: https://github.com/apache/pulsar/pull/14475#discussion_r816138594



##########
File path: pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/KafkaConnectSink.java
##########
@@ -290,4 +299,25 @@ protected long currentOffset(String topic, int partition) {
         return taskContext.currentOffset(topic, partition);
     }
 
+    // Replace all non-letter, non-digit characters with underscore.
+    // Append underscore in front of name if it does not begin with alphabet or underscore.
+    protected String sanitizeNameIfNeeded(String name, boolean sanitize) {

Review comment:
       static - doesn't matter. It uses cache instance, so it is either a static that accepts ache as a parameter or not static.
   
   unit tests - if the topic name is blank or null we already have problem somewhere. Variations of characters - look at the regex, it is either a-z/0-9 or not, no need to test for "." vs "/" vs "$" (or whatever else it's allowed in the topic name)
   
   




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org