Add support for unpooled JDBC datasources#1780
Add support for unpooled JDBC datasources#1780rrobetti wants to merge 16 commits intomicronaut-projects:7.0.xfrom
Conversation
Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
- Add new jdbc-unpooled module to settings.gradle - Create UnpooledDataSource: simple DataSource using DriverManager - Create DatasourceConfiguration: configuration bean with calculated settings - Create DatasourceFactory: factory for creating unpooled datasources - Add comprehensive tests for unpooled connections - Add JSpecify dependency to jdbc and jdbc-unpooled modules - All tests pass (10/10) - Checkstyle and Spotless pass Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
- Create jdbc-unpooled.adoc with full documentation - Update toc.yml to include unpooled datasource section - Update jdbc.adoc to mention unpooled option - Update jdbc-connection-pools.adoc table to include unpooled - Documentation covers installation, configuration, use cases, performance considerations - Includes examples for migration between pooled and unpooled - Comprehensive warnings about performance implications Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
- Add database proxy (CNAM, pgpool, Open J Proxy) as first use case in package-info.java - Update warning text to mention externalized connection pooling - Remove production and microservices restrictions (valid with proxies) - Add note about performance considerations not applying with database proxies - Update jdbc.adoc warning to include database proxy use case - Delete ANALYSIS_README.md and IMPLEMENTATION_CHECKLIST.md files Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Remove analysis document as requested - no longer needed in the PR. Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
…ction-pool Implement jdbc-unpooled module for unpooled database connections in Micronaut SQL
| @EachBean(DatasourceConfiguration.class) | ||
| @Requires(condition = JdbcDataSourceEnabled.class) | ||
| public DataSource dataSource(DatasourceConfiguration datasourceConfiguration) { | ||
| UnpooledDataSource ds = new UnpooledDataSource( |
There was a problem hiding this comment.
Why do we need a delegating UnpooledDataSource? You should simply create a DataSource that is specified (maybe also add some builder option)
There was a problem hiding this comment.
The rationale for implementing unpolled datasource support is documented here #1779.
There was a problem hiding this comment.
Not sure I understand, please describe the reason
|
Please sign CLA |
|
Maybe we can implement it without an extra dependency, simply by enable it with some property WDYT @radovanradic |
Maybe adding |
thanks for your comment, how would that look like? Can you provide more info? Should I change this implementation? |
I think what Denis suggested is there is no need for new module for this. Maybe you can just have UnpooledDatasourceFactory in jdbc module and then just create DataSource or as you named it UnpooledDataSource. And maybe there should be flag to tell whether datasource will be pooled to activate that factory, using condition similar to |
@dstepanov can you add your take on this? |
|
I don’t think we need a new module, maybe just an option like “allow-not-pulling-datasource=true” globally or per datasouce |
…rceConfiguration to jdbc module Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
…ed flag Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
…proach Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
Co-authored-by: rrobetti <7221783+rrobetti@users.noreply.github.com>
…urce Move unpooled datasource implementation to jdbc module with configuration flag
Implements Issue: #1779