
com.gruelbox.transactionoutbox.DataSourceConnectionProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of transactionoutbox-core Show documentation
Show all versions of transactionoutbox-core Show documentation
A safe implementation of the transactional outbox pattern for Java (core library)
package com.gruelbox.transactionoutbox;
import com.gruelbox.transactionoutbox.spi.Utils;
import java.sql.Connection;
import javax.sql.DataSource;
import lombok.Builder;
/**
* A {@link ConnectionProvider} which requests connections from a {@link DataSource}. This is
* suitable for applications using connection pools or container-provided JDBC.
*
* Usage:
*
*
ConnectionProvider provider = DataSourceConnectionProvider.builder()
* .dataSource(ds)
* .build()
*/
@Builder
final class DataSourceConnectionProvider implements ConnectionProvider {
private final DataSource dataSource;
@Override
public Connection obtainConnection() {
return Utils.uncheckedly(dataSource::getConnection);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy