|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.integration.jdbc.JdbcMessageStore
public class JdbcMessageStore
Implementation of MessageStore 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.
| Field Summary | |
|---|---|
static int |
DEFAULT_LONG_STRING_LENGTH
|
static java.lang.String |
DEFAULT_TABLE_PREFIX
Default value for the table prefix property. |
static java.lang.String |
ID_KEY
The name of the message header that stores the surrogate key used by this message store |
static java.lang.String |
VERSION_KEY
The name of the message header that stores the version used by this message store to implement optimistic locking |
| Constructor Summary | |
|---|---|
JdbcMessageStore()
Convenient constructor for configuration use. |
|
JdbcMessageStore(javax.sql.DataSource dataSource,
org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
Create a MessageStore with all mandatory properties. |
|
| Method Summary | ||
|---|---|---|
void |
afterPropertiesSet()
Check mandatory properties (data source and incrementer). |
|
Message<?> |
delete(java.lang.Object id)
Remove the Message with the given id from the MessageStore, if present, and return it. |
|
Message<?> |
get(java.lang.Object id)
Return the Message with the given id, or null if no Message with that id exists in the MessageStore. |
|
protected java.lang.String |
getQuery(java.lang.String base)
Replace patterns in the input to produce a valid SQL query. |
|
java.util.List<Message<?>> |
list()
Return all Messages currently in the MessageStore. |
|
java.util.List<Message<?>> |
list(java.lang.Object correlationId)
Return all Messages currently in the MessageStore that contain the provided correlationId header value. |
|
|
put(Message<T> message)
Put the provided Message into the MessageStore. |
|
void |
setDataSource(javax.sql.DataSource dataSource)
The JDBC DataSource to use when interacting with the database. |
|
void |
setIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
Setter for DataFieldMaxValueIncrementer to be used when
generating primary keys for Message instances. |
|
void |
setJdbcTemplate(org.springframework.jdbc.core.JdbcOperations jdbcTemplate)
The JdbcOperations to use when interacting with the database. |
|
void |
setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
Override the LobHandler that is used to create and unpack large
objects in SQL queries. |
|
void |
setTablePrefix(java.lang.String tablePrefix)
Public setter for the table prefix property. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_TABLE_PREFIX
public static final int DEFAULT_LONG_STRING_LENGTH
public static final java.lang.String ID_KEY
public static final java.lang.String VERSION_KEY
| Constructor Detail |
|---|
public JdbcMessageStore()
public JdbcMessageStore(javax.sql.DataSource dataSource,
org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
MessageStore with all mandatory properties.
dataSource - a DataSourceincrementer - a DataFieldMaxValueIncrementer| Method Detail |
|---|
protected java.lang.String getQuery(java.lang.String base)
base - the SQL query to be transformed
public void setTablePrefix(java.lang.String tablePrefix)
DEFAULT_TABLE_PREFIX.
tablePrefix - the tablePrefix to setpublic void setDataSource(javax.sql.DataSource dataSource)
DataSource to use when interacting with the database.
Either this property can be set or the
jdbcTemplate.
dataSource - a DataSourcepublic void setJdbcTemplate(org.springframework.jdbc.core.JdbcOperations jdbcTemplate)
JdbcOperations to use when interacting with the database.
Either this property can be set or the dataSource.
dataSource - a DataSourcepublic void setIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
DataFieldMaxValueIncrementer to be used when
generating primary keys for Message instances. The message store
manages its own surrogate keys for messages to avoid any ambiguity. When
you put a message in the store it should come back as a new instance with
a header called ID_KEY.
incrementer - the DataFieldMaxValueIncrementerpublic void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
LobHandler that is used to create and unpack large
objects in SQL queries. The default is fine for almost all platforms, but
some Oracle drivers require a native implementation.
lobHandler - a LobHandler
public void afterPropertiesSet()
throws java.lang.Exception
java.lang.Exceptionpublic Message<?> delete(java.lang.Object id)
MessageStore
delete in interface MessageStorepublic Message<?> get(java.lang.Object id)
MessageStore
get in interface MessageStorepublic java.util.List<Message<?>> list()
MessageStore
list in interface MessageStorepublic java.util.List<Message<?>> list(java.lang.Object correlationId)
MessageStore
list in interface MessageStoreMessageHeaders.getCorrelationId()public <T> Message<T> put(Message<T> message)
MessageStoreMessageStore.get(Object) and
MessageStore.delete(Object) behave properly. If available, its
correlationId header will also be stored so that the
MessageStore.list(Object) method behaves properly.
put in interface MessageStore
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||