@PublicEvolving public interface CatalogStoreFactory extends Factory
Factory for more information.
This factory is specifically designed for the Flink SQL gateway scenario, where different catalog stores need to be created for different sessions.
If the CatalogStore is implemented using JDBC, this factory can be used to create a JDBC connection pool in the open method. This connection pool can then be reused for subsequent catalog store creations.
The following examples implementation of CatalogStoreFactory using jdbc.
public class JdbcCatalogStore implements CatalogStore {
private JdbcConnectionPool jdbcConnectionPool;
public JdbcCatalogStore(JdbcConnectionPool jdbcConnectionPool) {
this.jdbcConnectionPool = jdbcConnectionPool;
}
...
}
public class JdbcCatalogStoreFactory implements CatalogStoreFactory {
private JdbcConnectionPool jdbcConnectionPool;| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
CatalogStoreFactory.Context
Context provided when a catalog store is created.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Close the CatalogStoreFactory.
|
CatalogStore |
createCatalogStore()
Creates a
CatalogStore instance from context information. |
void |
open(CatalogStoreFactory.Context context)
Initialize the CatalogStoreFactory.
|
factoryIdentifier, optionalOptions, requiredOptionsCatalogStore createCatalogStore()
CatalogStore instance from context information.void open(CatalogStoreFactory.Context context) throws CatalogException
For the use case of Flink SQL gateway, the open method will be called when starting SessionManager. It initializes common resources, such as a connection pool, for various catalog stores.
CatalogExceptionvoid close()
throws CatalogException
For the use case of Flink SQL gateway, the close method will be called when closing SessionManager. It releases common resources, such as connection pool, after closing all catalog stores.
CatalogExceptionCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.