INT-4308: Document JdbcMetadataStore
JIRA: https://jira.spring.io/browse/INT-4308 * Document `JdbcMetadataStore` * Remove unnecessary context DERBY config for the `PersistentAcceptOnceFileListFilterExternalStoreTests` * Rework the `testFileSystemWithJdbcMetadataStore()` to use `EmbeddedDatabase` directly, without context
This commit is contained in:
committed by
Gary Russell
parent
f52fdd85ab
commit
e475d9c695
@@ -988,3 +988,52 @@ Therefore `prefix` property must be used on the `DefaultLockRepository` bean def
|
||||
Sometimes it happens that one application has moved to the state when it can't release distributed lock - remove the particular record in the data base.
|
||||
For this purpose such dead locks can be expired by the other application on the next locking invocation.
|
||||
The `timeToLive` (TTL) option on the `DefaultLockRepository` is provided for this purpose.
|
||||
|
||||
[[jdbc-metadata-store]]
|
||||
=== JDBC Metadata Store
|
||||
|
||||
Starting with _version 5.0_, the JDBC `MetadataStore` (<<metadata-store>>) implementation is available.
|
||||
The `JdbcMetadataStore` can be used to maintain metadata state across application restarts.
|
||||
This `MetadataStore` implementation can be used with adapters such as:
|
||||
|
||||
* <<twitter-inbound>>
|
||||
* <<feed-inbound-channel-adapter>>
|
||||
* <<file-reading>>
|
||||
* <<ftp-inbound>>
|
||||
* <<sftp-inbound>>
|
||||
|
||||
In order to configure these adapters to use the `JdbcMetadataStore`, simply declare a Spring bean using the
|
||||
bean name *metadataStore*. The _Twitter Inbound Channel Adapter_ and the _Feed Inbound Channel Adapter_ will both
|
||||
automatically pick up and use the declared `JdbcMetadataStore`:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
@Bean
|
||||
public MetadataStore metadataStore(DataSource dataSource) {
|
||||
return new JdbcMetadataStore(dataSource);
|
||||
}
|
||||
----
|
||||
|
||||
Data base schema scripts for several RDMBS vendors are located in the `org.springframework.integration.jdbc` package.
|
||||
For example the H2 DDL for metadata table looks like:
|
||||
|
||||
[source,sql]
|
||||
----
|
||||
CREATE TABLE INT_METADATA_STORE (
|
||||
METADATA_KEY VARCHAR(255) NOT NULL,
|
||||
METADATA_VALUE VARCHAR(4000),
|
||||
REGION VARCHAR(100) NOT NULL,
|
||||
constraint METADATA_STORE primary key (METADATA_KEY, REGION)
|
||||
);
|
||||
----
|
||||
|
||||
The `INT_` prefix can be changed according to the target data base design requirements and the `JdbcMetadataStore` can be configured to use the custom prefix.
|
||||
|
||||
The `JdbcMetadataStore` implements `ConcurrentMetadataStore`, allowing it to be reliably shared across multiple
|
||||
application instances where only one instance will be allowed to store or modify a key's value.
|
||||
All of these operations are _atomic_ via transaction guarantees.
|
||||
|
||||
Transaction management is required to use `JdbcMetadataStore`.
|
||||
Inbound Channel Adapters can be supplied with a reference to the `TransactionManager` in the poller configuration.
|
||||
Unlike non-transactional `MetadataStore` implementations, with `JdbcMetadataStore`, the entry appears in the target table only after the transaction commits.
|
||||
When a rollback occurs, no entries is added to the `INT_METADATA_STORE` table.
|
||||
|
||||
@@ -14,9 +14,10 @@ If you need to persist metadata between Application Context restarts, these pers
|
||||
the framework:
|
||||
|
||||
* `PropertiesPersistingMetadataStore`
|
||||
* <<redis-metadata-store>>
|
||||
* <<gemfire-metadata-store>>
|
||||
* <<jdbc-metadata-store>>
|
||||
* <<mongodb-metadata-store>>
|
||||
* <<redis-metadata-store>>
|
||||
* <<zk-metadata-store>>
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,13 @@ The `ErrorMessagePublisher` and the `ErrorMessageStrategy` are provided for crea
|
||||
|
||||
See <<namespace-errorhandler>> for more information.
|
||||
|
||||
==== JDBC Metadata Store
|
||||
|
||||
A JDBC implementation of `MetadataStore` implementation is now provided.
|
||||
This is useful when it is necessary to ensure transactional boundaries for metadata.
|
||||
|
||||
See <<jdbc-metadata-store>> for more information.
|
||||
|
||||
[[x5.0-general]]
|
||||
=== General Changes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user