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


##########
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:
   Fixed. Used the latter



-- 
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