public class JdbcMetadataStore extends java.lang.Object implements ConcurrentMetadataStore, org.springframework.beans.factory.InitializingBean
MetadataStore 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 MetadataStore.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_TABLE_PREFIX
Default value for the table prefix property.
|
| Constructor and Description |
|---|
JdbcMetadataStore(javax.sql.DataSource dataSource)
Instantiate a
JdbcMetadataStore using provided dataSource DataSource. |
JdbcMetadataStore(org.springframework.jdbc.core.JdbcOperations jdbcOperations)
Instantiate a
JdbcMetadataStore using provided jdbcOperations JdbcOperations. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
java.lang.String |
get(java.lang.String key)
Reads a value for the given key from this MetadataStore.
|
void |
put(java.lang.String key,
java.lang.String value)
Writes a key value pair to this MetadataStore.
|
java.lang.String |
putIfAbsent(java.lang.String key,
java.lang.String value)
Atomically insert the key into the store.
|
java.lang.String |
remove(java.lang.String key)
Remove a value for the given key from this MetadataStore.
|
boolean |
replace(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
Atomically replace the value for the key in the store if the old
value matches the oldValue argument.
|
void |
setLockHint(java.lang.String lockHint)
Specify a row lock hint for the query in the lock-based operations.
|
void |
setRegion(java.lang.String region)
A unique grouping identifier for all messages persisted with this store.
|
void |
setTablePrefix(java.lang.String tablePrefix)
Public setter for the table prefix property.
|
public static final java.lang.String DEFAULT_TABLE_PREFIX
public JdbcMetadataStore(javax.sql.DataSource dataSource)
JdbcMetadataStore using provided dataSource DataSource.dataSource - a DataSourcepublic JdbcMetadataStore(org.springframework.jdbc.core.JdbcOperations jdbcOperations)
JdbcMetadataStore using provided jdbcOperations JdbcOperations.jdbcOperations - a JdbcOperationspublic void setTablePrefix(java.lang.String tablePrefix)
DEFAULT_TABLE_PREFIX.tablePrefix - the tablePrefix to setpublic void setRegion(java.lang.String region)
DEFAULT.region - the region name to setpublic void setLockHint(java.lang.String lockHint)
FOR 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 requires WITH (ROWLOCK).lockHint - the RDBMS vendor-specific lock hint.public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean@Transactional
public java.lang.String putIfAbsent(java.lang.String key,
java.lang.String value)
ConcurrentMetadataStoreputIfAbsent in interface ConcurrentMetadataStorekey - The key.value - The value.@Transactional
public boolean replace(java.lang.String key,
java.lang.String oldValue,
java.lang.String newValue)
ConcurrentMetadataStorereplace in interface ConcurrentMetadataStorekey - The key.oldValue - The old value.newValue - The new value.@Transactional
public void put(java.lang.String key,
java.lang.String value)
MetadataStoreput in interface MetadataStorekey - The key.value - The value.@Transactional public java.lang.String get(java.lang.String key)
MetadataStoreget in interface MetadataStorekey - The key.@Transactional public java.lang.String remove(java.lang.String key)
MetadataStoreremove in interface MetadataStorekey - The key.