Class JdbcMetadataStore
java.lang.Object
org.springframework.integration.jdbc.metadata.JdbcMetadataStore
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,org.springframework.integration.metadata.ConcurrentMetadataStore,org.springframework.integration.metadata.MetadataStore
public class JdbcMetadataStore
extends java.lang.Object
implements org.springframework.integration.metadata.ConcurrentMetadataStore, org.springframework.beans.factory.InitializingBean
Implementation of
ConcurrentMetadataStore using a relational database via JDBC.
SQL scripts to create the necessary tables are packaged as
org/springframework/integration/jdbc/schema-*.sql,
where * is the target database type.
The transaction management is required to use this ConcurrentMetadataStore.
- Since:
- 5.0
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_TABLE_PREFIXDefault value for the table prefix property. -
Constructor Summary
Constructors Constructor Description JdbcMetadataStore(javax.sql.DataSource dataSource)Instantiate aJdbcMetadataStoreusing provided dataSourceDataSource.JdbcMetadataStore(org.springframework.jdbc.core.JdbcOperations jdbcOperations)Instantiate aJdbcMetadataStoreusing provided jdbcOperationsJdbcOperations. -
Method Summary
Modifier and Type Method Description voidafterPropertiesSet()java.lang.Stringget(java.lang.String key)voidput(java.lang.String key, java.lang.String value)java.lang.StringputIfAbsent(java.lang.String key, java.lang.String value)java.lang.Stringremove(java.lang.String key)booleanreplace(java.lang.String key, java.lang.String oldValue, java.lang.String newValue)voidsetLockHint(java.lang.String lockHint)Specify a row lock hint for the query in the lock-based operations.voidsetRegion(java.lang.String region)A unique grouping identifier for all messages persisted with this store.voidsetTablePrefix(java.lang.String tablePrefix)Public setter for the table prefix property.
-
Field Details
-
DEFAULT_TABLE_PREFIX
public static final java.lang.String DEFAULT_TABLE_PREFIXDefault value for the table prefix property.- See Also:
- Constant Field Values
-
-
Constructor Details
-
JdbcMetadataStore
public JdbcMetadataStore(javax.sql.DataSource dataSource)Instantiate aJdbcMetadataStoreusing provided dataSourceDataSource.- Parameters:
dataSource- aDataSource
-
JdbcMetadataStore
public JdbcMetadataStore(org.springframework.jdbc.core.JdbcOperations jdbcOperations)Instantiate aJdbcMetadataStoreusing provided jdbcOperationsJdbcOperations.- Parameters:
jdbcOperations- aJdbcOperations
-
-
Method Details
-
setTablePrefix
public void setTablePrefix(java.lang.String tablePrefix)Public setter for the table prefix property. This will be prefixed to all the table names before queries are executed. Defaults toDEFAULT_TABLE_PREFIX.- Parameters:
tablePrefix- the tablePrefix to set
-
setRegion
public void setRegion(java.lang.String region)A unique grouping identifier for all messages persisted with this store. Using multiple regions allows the store to be partitioned (if necessary) for different purposes. Defaults toDEFAULT.- Parameters:
region- the region name to set
-
setLockHint
public void setLockHint(java.lang.String lockHint)Specify a row lock hint for the query in the lock-based operations. Defaults toFOR UPDATE. Can be specified as an empty string, if the target RDBMS doesn't support locking on tables from queries. The value depends from RDBMS vendor, e.g. SQL Server requiresWITH (ROWLOCK).- Parameters:
lockHint- the RDBMS vendor-specific lock hint.- Since:
- 5.0.7
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
putIfAbsent
@Transactional public java.lang.String putIfAbsent(java.lang.String key, java.lang.String value)- Specified by:
putIfAbsentin interfaceorg.springframework.integration.metadata.ConcurrentMetadataStore
-
replace
@Transactional public boolean replace(java.lang.String key, java.lang.String oldValue, java.lang.String newValue)- Specified by:
replacein interfaceorg.springframework.integration.metadata.ConcurrentMetadataStore
-
put
@Transactional public void put(java.lang.String key, java.lang.String value)- Specified by:
putin interfaceorg.springframework.integration.metadata.MetadataStore
-
get
@Transactional public java.lang.String get(java.lang.String key)- Specified by:
getin interfaceorg.springframework.integration.metadata.MetadataStore
-
remove
@Transactional public java.lang.String remove(java.lang.String key)- Specified by:
removein interfaceorg.springframework.integration.metadata.MetadataStore
-