This repository implementation can be used to store the feature state in SQL database using the standard JDBC API.
{@link JDBCStateRepository} stores the feature state in a single database table. You can choose the name of this table usinga constructor argument. If the repository doesn't find the required table in the database, it will automatically create it.
The database table has the following format:
CREATE TABLE <table> ( FEATURE_NAME VARCHAR(100) PRIMARY KEY, FEATURE_ENABLED INTEGER, STRATEGY_ID VARCHAR(200), STRATEGY_PARAMS VARCHAR(2000) )
The class provides a builder which can be used to configure the repository:
StateRepository repository = JDBCStateRepository.newBuilder(dataSource) .tableName("features") .createTable(false) .serializer(DefaultMapSerializer.singleline()) .noCommit(true) .build();
Please note that the structure of the database table changed with version 2.0.0 because of the new extensible activation strategy mechanism. The table structure will be automatically migrated to the new format.
@author Christian Kaltepoth
|
|