ptrdom commented on PR #194:
URL: 
https://github.com/apache/pekko-persistence-r2dbc/pull/194#issuecomment-2646478075

   While working on the initial design I spotted few overcomplications with it, 
particularly when it came to implementation of shared connection factories, so 
I made a few changes to simplify:
   
   1. Added new method to `ConnectionFactoryProvider` implementation that 
accepts config.
      
      You can now both supply full path to conneciton factory config and config 
in which this path should be looked up. If the supplied config is missing this 
path, then it will be looked up in `ActorSystem`'s config. What persistence 
plugins now do is pass the config that is passed to them at runtime to this new 
method.
   
      This allows configuration of all expected scenarios - startup-time and 
runtime config for both shared and non-shared connection factories. Connection 
factories remain shared by default as they were before. Full path remains the 
ID of connection factory for sharing purposes.
   
      This is very similar to how persistence plugin config is already 
implemented, so should feel familiar to users.
   
   1. Plugin config uses `use-connection-factory` config key instead of direct 
plugin configuration.
   
      This is how projection module already does it on its side, and it 
actually works really nicely for all use cases - if you want to share the 
connection factory, then just put it on the same path that all plugins can use, 
if you want to use unique connection factories, then you just need to put the 
config on an unique path. With an implementation like this there is no need for 
special purpose config keys - like the ones that JDBC plugin uses.
   
   With these changes the other TODOs could be done in their own tickets:
   
   1. Shared settings are now provided through inheritance:
   
      
https://github.com/apache/pekko-persistence-r2dbc/blob/b28968057679e621591ac9bc21bab0daba13eebb/core/src/main/resources/reference.conf#L4-L8
   
      Ideally the break up of shared settings would still be done, but it does 
not seem as critical.
   
   1. Projection module remains compatible with core module changes done in 
this PR, but it **is not** compatible with runtime persistence plugin config 
feature. 
   
      Even though `use-connection-factory` can be set at runtime, projection 
using it becomes sensitive to initialization order, because projection cannot 
see runtime config that is provided to the persistence plugin, so if the 
projection runs before the plugin is initialized, it will fail. I feel that 
users should not be expected to be careful of that. Also, if persistence plugin 
and projection are running in separate `ActorSystem`s, then even the tight 
control of the initialization order will not make the projection work.
   
      This will be addressed in a separate PR.
   
   I will look though the PR again for any things that were potentially missed, 
clean it up and mark as ready for review.


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