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