You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2019/05/29 21:37:39 UTC

[GitHub] [samza] mynameborat commented on a change in pull request #1055: SAMZA-2227 : Fix to ensure that new topics detected by regex-monitor are picked up during next deployment of app

mynameborat commented on a change in pull request #1055: SAMZA-2227 : Fix to ensure that new topics detected by regex-monitor are picked up during next deployment of app
URL: https://github.com/apache/samza/pull/1055#discussion_r288712181
 
 

 ##########
 File path: samza-core/src/main/scala/org/apache/samza/util/Util.scala
 ##########
 @@ -140,17 +140,26 @@ object Util extends Logging {
    * @return re-written config
    */
   def rewriteConfig(config: Config): Config = {
-    def rewrite(c: Config, rewriterName: String): Config = {
-      val rewriterClassName = config
-              .getConfigRewriterClass(rewriterName)
-              .getOrElse(throw new SamzaException("Unable to find class config for config rewriter %s." format rewriterName))
-      val rewriter = Util.getObj(rewriterClassName, classOf[ConfigRewriter])
-      info("Re-writing config with " + rewriter)
-      rewriter.rewrite(rewriterName, c)
+    config.getConfigRewriters match {
+      case Some(rewriters) => rewriters.split(",").foldLeft(config)(rewrite(_, _))
+      case _ => config
     }
+  }
 
+  private def rewrite(c: Config, rewriterName: String): Config = {
+    val rewriterClassName = c
+      .getConfigRewriterClass(rewriterName)
+      .getOrElse(throw new SamzaException("Unable to find class config for config rewriter %s." format rewriterName))
+    val rewriter = Util.getObj(rewriterClassName, classOf[ConfigRewriter])
 
 Review comment:
   Use ReflectionUtils instead

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services