pjfanning commented on code in PR #171:
URL: 
https://github.com/apache/pekko-persistence-r2dbc/pull/171#discussion_r1830717484


##########
core/src/main/scala/org/apache/pekko/persistence/r2dbc/ConnectionFactoryProvider.scala:
##########
@@ -62,13 +73,29 @@ class ConnectionFactoryProvider(system: ActorSystem[_]) 
extends Extension {
         configLocation => {
           val config = system.settings.config.getConfig(configLocation)
           val settings = new ConnectionFactorySettings(config)
-          createConnectionPoolFactory(settings)
+          val customizer = createConnectionFactoryOptionsCustomizer(settings)
+          createConnectionPoolFactory(settings, customizer, config)
         })
       .asInstanceOf[ConnectionFactory]
   }
 
-  private def createConnectionFactory(settings: ConnectionFactorySettings): 
ConnectionFactory = {
+  private def createConnectionFactoryOptionsCustomizer(
+      settings: ConnectionFactorySettings): ConnectionFactoryOptionsCustomizer 
= {
+    settings.connectionFactoryOptionsCustomizer match {
+      case None => NoopCustomizer
+      case Some(fqcn) =>
+        val args = List(classOf[ActorSystem[_]] -> system)
+        
system.dynamicAccess.createInstanceFor[ConnectionFactoryOptionsCustomizer](fqcn,
 args) match {
+          case Success(customizer) => customizer
+          case Failure(cause) =>
+            throw new RuntimeException("Failed to create 
ConnectionFactoryOptionsCustomizer", cause)

Review Comment:
   Could you make this an IllegalStateException and include the invalid FCQN 
value in the message?



##########
core/src/test/scala/org/apache/pekko/persistence/r2dbc/ConnectionFactoryOptionsCustomizerSpec.scala:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more

Review Comment:
   this is not the right source header for new files - see point 5 in 
https://github.com/apache/pekko/blob/main/CONTRIBUTING.md#pull-request-requirements



-- 
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: notifications-unsubscr...@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org
For additional commands, e-mail: notifications-h...@pekko.apache.org

Reply via email to