All Projects → r2dbc → R2dbc Pool

r2dbc / R2dbc Pool

Licence: apache-2.0
Connection Pooling for Reactive Relational Database Connectivity

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to R2dbc Pool

Mobc
A generic connection pool for Rust with async/await support
Stars: ✭ 141 (+0%)
Mutual labels:  database, connection-pool
Reactivemongo
🍃 Non-blocking, Reactive MongoDB Driver for Scala
Stars: ✭ 825 (+485.11%)
Mutual labels:  reactive, database
R2dbc Mysql
R2DBC MySQL Implementation
Stars: ✭ 417 (+195.74%)
Mutual labels:  reactive, database
Rxdb
🔄 A client side, offline-first, reactive database for JavaScript Applications
Stars: ✭ 16,670 (+11722.7%)
Mutual labels:  reactive, database
Rxrealm
RxSwift extension for RealmSwift's types
Stars: ✭ 1,007 (+614.18%)
Mutual labels:  reactive, database
R2dbc Client
Reactive Relational Database Connectivity
Stars: ✭ 347 (+146.1%)
Mutual labels:  reactive, database
R2dbc Postgresql
Postgresql R2DBC Driver
Stars: ✭ 714 (+406.38%)
Mutual labels:  reactive, database
Rxgrdb
Reactive extensions for SQLite
Stars: ✭ 176 (+24.82%)
Mutual labels:  reactive, database
Watermelondb
🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
Stars: ✭ 7,996 (+5570.92%)
Mutual labels:  reactive, database
Flexy Pool
FlexyPool adds metrics and failover strategies to a given Connection Pool, allowing it to resize on demand.
Stars: ✭ 856 (+507.09%)
Mutual labels:  database, connection-pool
R2dbc Spi
Service Provider Interface for R2DBC Implementations
Stars: ✭ 252 (+78.72%)
Mutual labels:  reactive, database
Filodb
Distributed Prometheus time series database
Stars: ✭ 1,286 (+812.06%)
Mutual labels:  reactive, database
Grdbcombine
GRDB ❤️ Combine
Stars: ✭ 220 (+56.03%)
Mutual labels:  reactive, database
Rxjava2 Jdbc
RxJava2 integration with JDBC including Non-blocking Connection Pools
Stars: ✭ 360 (+155.32%)
Mutual labels:  reactive, database
Barrel Platform
Distributed database for the modern world
Stars: ✭ 201 (+42.55%)
Mutual labels:  reactive, database
Rxfirebase
Rxjava 2.0 wrapper on Google's Android Firebase library.
Stars: ✭ 509 (+260.99%)
Mutual labels:  reactive, database
Dbutils
Database connections for multi-threaded environments
Stars: ✭ 212 (+50.35%)
Mutual labels:  database, connection-pool
Vue Materialize Datatable
A fancy Materialize CSS datatable VueJS component.
Stars: ✭ 162 (+14.89%)
Mutual labels:  reactive, database
Realm Core
Core database component for the Realm Mobile Database SDKs
Stars: ✭ 836 (+492.91%)
Mutual labels:  reactive, database
Rdbc
Asynchronous database access for Scala and Java
Stars: ✭ 78 (-44.68%)
Mutual labels:  reactive, database

Reactive Relational Database Connectivity Connection Pool Implementation Java CI with Maven Maven Central

This project contains a R2DBC connection pool using reactor-pool for reactive connection pooling.

Code of Conduct

This project is governed by the R2DBC Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].

Getting Started

Configuration of the ConnectionPool can be accomplished in several ways:

URL Connection Factory Discovery

ConnectionFactory connectionFactory = ConnectionFactories.get("r2dbc:pool:<my-driver>://<host>:<port>/<database>[?maxIdleTime=PT60S[&…]");

Publisher<? extends Connection> connectionPublisher = connectionFactory.create();

Programmatic Connection Factory Discovery

ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder()
   .option(DRIVER, "pool")
   .option(PROTOCOL, "postgresql") // driver identifier, PROTOCOL is delegated as DRIVER by the pool.
   .option(HOST, "…")
   .option(PORT, "…") 
   .option(USER, "…")
   .option(PASSWORD, "…")
   .option(DATABASE, "…")
   .build());

The delegated DRIVER (via PROTOCOL) above refers to the r2dbc-driver, such as h2, postgresql, mssql, mysql, spanner.

Publisher<? extends Connection> connectionPublisher = connectionFactory.create();

// Alternative: Creating a Mono using Project Reactor
Mono<Connection> connectionMono = Mono.from(connectionFactory.create());

Supported ConnectionFactory Discovery Options

Option Description
driver Must be pool
protocol Driver identifier. The value is propagated by the pool to the driver property.
acquireRetry Number of retries if the first connection acquiry attempt fails. Defaults to 1.
initialSize Initial pool size. Defaults to 10.
maxSize Maximum pool size. Defaults to 10.
maxLifeTime Maximum lifetime of the connection in the pool. Negative values indicate no timeout. Defaults to no timeout.
maxIdleTime Maximum idle time of the connection in the pool. Negative values indicate no timeout. Defaults to no timeout.
maxAcquireTime Maximum time to acquire connection from pool. Negative values indicate no timeout. Defaults to no timeout.
maxCreateConnectionTime Maximum time to create a new connection. Negative values indicate no timeout. Defaults to no timeout.
poolName Name of the Connection Pool.
registerJmx Whether to register the pool to JMX.
validationDepth Validation depth used to validate an R2DBC connection. Defaults to LOCAL.
validationQuery Query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive.

All other properties are driver-specific.

Programmatic Configuration

ConnectionFactory connectionFactory = ;

ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(connectionFactory)
   .maxIdleTime(Duration.ofMillis(1000))
   .maxSize(20)
   .build();

ConnectionPool pool = new ConnectionPool(configuration);
 

Mono<Connection> connectionMono = pool.create();

// later

Connection connection = ;
Mono<Void> release = connection.close(); // released the connection back to the pool

// application shutdown
pool.dispose();

Maven configuration

Artifacts can be found on Maven Central:

<dependency>
  <groupId>io.r2dbc</groupId>
  <artifactId>r2dbc-pool</artifactId>
  <version>${version}</version>
</dependency>

If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.

<dependency>
  <groupId>io.r2dbc</groupId>
  <artifactId>r2dbc-pool</artifactId>
  <version>${version}.BUILD-SNAPSHOT</version>
</dependency>

<repository>
  <id>sonatype-nexus-snapshots</id>
  <name>Sonatype OSS Snapshot Repository</name>
  <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

Getting Help

Having trouble with R2DBC? We'd love to help!

Reporting Issues

R2DBC uses GitHub as issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:

  • Before you log a bug, please search the issue tracker to see if someone has already reported the problem.
  • If the issue doesn't already exist, create a new issue.
  • Please provide as much information as possible with the issue report, we like to know the version of R2DBC Pool that you are using and JVM version.
  • If you need to paste code, or include a stack trace use Markdown ``` escapes before and after your text.
  • If possible try to create a test-case or project that replicates the issue. Attach a link to your code or a compressed file containing your code.

Building from Source

You don't need to build from source to use R2DBC Pool (binaries in Maven Central), but if you want to try out the latest and greatest, R2DBC Pool can be easily built with the maven wrapper. You also need JDK 1.8.

 $ ./mvnw clean install

If you want to build with the regular mvn command, you will need Maven v3.5.0 or above.

Also see CONTRIBUTING.adoc if you wish to submit pull requests. Commits require Signed-off-by (git commit -s) to ensure Developer Certificate of Origin.

Staging to Maven Central

To stage a release to Maven Central, you need to create a release tag (release version) that contains the desired state and version numbers (mvn versions:set versions:commit -q -o -DgenerateBackupPoms=false -DnewVersion=x.y.z.(RELEASE|Mnnn|RCnnn) and force-push it to the release-0.x branch. This push will trigger a Maven staging build (see build-and-deploy-to-maven-central.sh).

License

This project is released under version 2.0 of the Apache License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].