diff --git a/spring-integration-jdbc/build.gradle b/spring-integration-jdbc/build.gradle index 7c15f85d3d..ae833b8779 100644 --- a/spring-integration-jdbc/build.gradle +++ b/spring-integration-jdbc/build.gradle @@ -26,8 +26,8 @@ task generateSql { classpath: configurations.vpp.asPath) doLast { - ['hsqldb', 'h2', 'db2', 'derby', 'mysql', 'mysql-5_6_4', - 'oracle10g', 'postgresql', 'sqlserver', 'sybase'].each { dbType -> + ['hsqldb', 'h2', 'db2', 'derby', 'mysql', 'oracle', 'postgresql', 'sqlserver', 'sybase'] + .each { dbType -> ant.vppcopy(todir: generatedResourcesDir) { config { context { diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java index 3187ca6642..2941c40885 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParser.java @@ -23,11 +23,11 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.integration.config.xml.IntegrationNamespaceUtils; -import org.springframework.integration.jdbc.JdbcMessageStore; +import org.springframework.integration.jdbc.store.JdbcMessageStore; import org.springframework.util.StringUtils; /** - * Parser for {@link org.springframework.integration.jdbc.JdbcMessageStore}. + * Parser for {@link JdbcMessageStore}. * * @author Dave Syer * @since 2.0 @@ -45,19 +45,19 @@ public class JdbcMessageStoreParser extends AbstractBeanDefinitionParser { String dataSourceRef = element.getAttribute("data-source"); String simpleJdbcOperationsRef = element.getAttribute("jdbc-operations"); boolean refToDataSourceSet = StringUtils.hasText(dataSourceRef); - boolean refToSimpleJdbcOperaitonsSet = StringUtils.hasText(simpleJdbcOperationsRef); - if ((refToDataSourceSet && refToSimpleJdbcOperaitonsSet) - || (!refToDataSourceSet && !refToSimpleJdbcOperaitonsSet)) { + boolean refToSimpleJdbcOperationsSet = StringUtils.hasText(simpleJdbcOperationsRef); + if ((refToDataSourceSet && refToSimpleJdbcOperationsSet) + || (!refToDataSourceSet && !refToSimpleJdbcOperationsSet)) { parserContext.getReaderContext().error( "Exactly one of the attributes data-source or " + "simple-jdbc-operations should be set for the JDBC message-store", source); } if (refToDataSourceSet) { - builder.addPropertyReference("dataSource", dataSourceRef); + builder.addConstructorArgReference(dataSourceRef); } else { - builder.addPropertyReference("jdbcTemplate", simpleJdbcOperationsRef); + builder.addConstructorArgReference(simpleJdbcOperationsRef); } IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "lob-handler"); diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java index d78b1bbf14..3f6d9aa9c9 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java @@ -42,7 +42,6 @@ import org.springframework.core.serializer.support.DeserializingConverter; import org.springframework.core.serializer.support.SerializingConverter; import org.springframework.dao.DuplicateKeyException; import org.springframework.integration.IntegrationMessageHeaderAccessor; -import org.springframework.integration.jdbc.JdbcMessageStore; import org.springframework.integration.jdbc.store.channel.ChannelMessageStoreQueryProvider; import org.springframework.integration.jdbc.store.channel.MessageRowMapper; import org.springframework.integration.jdbc.store.channel.OracleChannelMessageStoreQueryProvider; @@ -81,7 +80,7 @@ import org.springframework.util.StringUtils; * Contrary to the {@link JdbcMessageStore}, this implementation uses a single database table, * optimized to operate like a queue. * The SQL scripts for creating the table are packaged - * under {@code org/springframework/integration/jdbc/messagestore/channel/schema-*.sql}, + * under {@code org/springframework/integration/jdbc/schema-*.sql}, * where {@code *} denotes the target database type. *

* diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java similarity index 94% rename from spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageStore.java rename to spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java index 12b74d39bd..027803fb95 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/JdbcMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcMessageStore.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.jdbc; +package org.springframework.integration.jdbc.store; import java.sql.ResultSet; import java.sql.SQLException; @@ -35,13 +35,11 @@ import javax.sql.DataSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.InitializingBean; import org.springframework.core.serializer.Deserializer; import org.springframework.core.serializer.Serializer; import org.springframework.core.serializer.support.DeserializingConverter; import org.springframework.core.serializer.support.SerializingConverter; import org.springframework.dao.DuplicateKeyException; -import org.springframework.integration.jdbc.store.JdbcChannelMessageStore; import org.springframework.integration.store.AbstractMessageGroupStore; import org.springframework.integration.store.MessageGroup; import org.springframework.integration.store.MessageMetadata; @@ -66,9 +64,6 @@ import org.springframework.util.StringUtils; * tables are packaged as org/springframework/integration/jdbc/schema-*.sql, where * is the * target database type. *

- * Notice: Starting with Spring Integration 5.0, this class will move to package: - * {@code org.springframework.integration.jdbc.store}. - *

* If you intend backing a {@link MessageChannel} using a JDBC-based Message Store, * please consider using the channel-specific {@link JdbcChannelMessageStore} instead. * This implementation is intended for correlation components (e.g. {@code }), @@ -84,7 +79,7 @@ import org.springframework.util.StringUtils; * * @since 2.0 */ -public class JdbcMessageStore extends AbstractMessageGroupStore implements MessageStore, InitializingBean { +public class JdbcMessageStore extends AbstractMessageGroupStore implements MessageStore { private static final Log logger = LogFactory.getLog(JdbcMessageStore.class); @@ -192,7 +187,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa private volatile String tablePrefix = DEFAULT_TABLE_PREFIX; - private volatile JdbcOperations jdbcTemplate; + private final JdbcOperations jdbcTemplate; private volatile DeserializingConverter deserializer; @@ -203,21 +198,23 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa private volatile Map queryCache = new HashMap(); /** - * Convenient constructor for configuration use. + * Create a {@link MessageStore} with all mandatory properties. + * @param dataSource a {@link DataSource} */ - public JdbcMessageStore() { - this.deserializer = new DeserializingConverter(); - this.serializer = new SerializingConverter(); + public JdbcMessageStore(DataSource dataSource) { + this(new JdbcTemplate(dataSource)); } /** * Create a {@link MessageStore} with all mandatory properties. - * - * @param dataSource a {@link DataSource} + * @param jdbcOperations a {@link JdbcOperations} + * @since 4.3.9 */ - public JdbcMessageStore(DataSource dataSource) { - this(); - this.jdbcTemplate = new JdbcTemplate(dataSource); + public JdbcMessageStore(JdbcOperations jdbcOperations) { + Assert.notNull(jdbcOperations, "'dataSource' must not be null"); + this.jdbcTemplate = jdbcOperations; + this.deserializer = new DeserializingConverter(); + this.serializer = new SerializingConverter(); } /** @@ -241,26 +238,6 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.region = region; } - /** - * The JDBC {@link DataSource} to use when interacting with the database. Either this property can be set or the - * {@link #setJdbcTemplate(JdbcOperations) jdbcTemplate}. - * - * @param dataSource a {@link DataSource} - */ - public void setDataSource(DataSource dataSource) { - this.jdbcTemplate = new JdbcTemplate(dataSource); - } - - /** - * The {@link JdbcOperations} to use when interacting with the database. Either this property can be set or the - * {@link #setDataSource(DataSource) dataSource}. - * - * @param jdbcTemplate a {@link JdbcOperations} - */ - public void setJdbcTemplate(JdbcOperations jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - /** * Override the {@link 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. @@ -291,11 +268,6 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa this.deserializer = new DeserializingConverter((Deserializer) deserializer); } - @Override - public void afterPropertiesSet() throws Exception { - Assert.state(this.jdbcTemplate != null, "A DataSource or JdbcTemplate must be provided"); - } - @Override public Message removeMessage(UUID id) { Message message = getMessage(id); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-db2.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-db2.sql index 7385db5be8..f7df8fb7b6 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-db2.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-db2.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ); + +CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CACHE NO CYCLE; + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL , + MESSAGE_BYTES BLOB, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +); + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-derby.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-derby.sql index 7385db5be8..ccc16c1dfc 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-derby.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-derby.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ); + + + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), + MESSAGE_BYTES BLOB, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +); + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-db2.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-db2.sql index cfb68b5bc4..55c72d9705 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-db2.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-db2.sql @@ -1,7 +1,11 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 ; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX ; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX ; DROP TABLE INT_MESSAGE ; DROP TABLE INT_MESSAGE_GROUP ; DROP TABLE INT_GROUP_TO_MESSAGE ; DROP TABLE INT_LOCK ; -DROP INDEX INT_MESSAGE_IX1 ; +DROP TABLE INT_CHANNEL_MESSAGE ; + DROP SEQUENCE INT_MESSAGE_SEQ ; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-derby.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-derby.sql index cfb68b5bc4..1740fb9565 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-derby.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-derby.sql @@ -1,7 +1,10 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 ; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX ; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX ; DROP TABLE INT_MESSAGE ; DROP TABLE INT_MESSAGE_GROUP ; DROP TABLE INT_GROUP_TO_MESSAGE ; DROP TABLE INT_LOCK ; -DROP INDEX INT_MESSAGE_IX1 ; +DROP TABLE INT_CHANNEL_MESSAGE ; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-h2.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-h2.sql index c51aaafa05..940b7391e5 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-h2.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-h2.sql @@ -1,7 +1,11 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 IF EXISTS; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX IF EXISTS; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX IF EXISTS; DROP TABLE INT_MESSAGE IF EXISTS; DROP TABLE INT_MESSAGE_GROUP IF EXISTS; DROP TABLE INT_GROUP_TO_MESSAGE IF EXISTS; DROP TABLE INT_LOCK IF EXISTS; -DROP INDEX INT_MESSAGE_IX1 IF EXISTS; +DROP TABLE INT_CHANNEL_MESSAGE IF EXISTS; + DROP SEQUENCE INT_MESSAGE_SEQ IF EXISTS; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-hsqldb.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-hsqldb.sql index c51aaafa05..940b7391e5 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-hsqldb.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-hsqldb.sql @@ -1,7 +1,11 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 IF EXISTS; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX IF EXISTS; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX IF EXISTS; DROP TABLE INT_MESSAGE IF EXISTS; DROP TABLE INT_MESSAGE_GROUP IF EXISTS; DROP TABLE INT_GROUP_TO_MESSAGE IF EXISTS; DROP TABLE INT_LOCK IF EXISTS; -DROP INDEX INT_MESSAGE_IX1 IF EXISTS; +DROP TABLE INT_CHANNEL_MESSAGE IF EXISTS; + DROP SEQUENCE INT_MESSAGE_SEQ IF EXISTS; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-mysql-5_6_4.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-mysql-5_6_4.sql deleted file mode 100644 index badab9b282..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-mysql-5_6_4.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Autogenerated: do not edit this file - -DROP TABLE IF EXISTS INT_MESSAGE ; -DROP TABLE IF EXISTS INT_MESSAGE_GROUP ; -DROP TABLE IF EXISTS INT_GROUP_TO_MESSAGE ; -DROP TABLE IF EXISTS INT_LOCK ; -DROP INDEX IF EXISTS INT_MESSAGE_IX1 ; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-mysql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-mysql.sql index badab9b282..4d9ec5fcd3 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-mysql.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-mysql.sql @@ -1,7 +1,10 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX IF EXISTS INT_MESSAGE_IX1 ; +DROP INDEX IF EXISTS INT_CHANNEL_MSG_DATE_IDX ; +DROP INDEX IF EXISTS INT_CHANNEL_MSG_PRIORITY_IDX ; DROP TABLE IF EXISTS INT_MESSAGE ; DROP TABLE IF EXISTS INT_MESSAGE_GROUP ; DROP TABLE IF EXISTS INT_GROUP_TO_MESSAGE ; DROP TABLE IF EXISTS INT_LOCK ; -DROP INDEX IF EXISTS INT_MESSAGE_IX1 ; +DROP TABLE IF EXISTS INT_CHANNEL_MESSAGE ; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-oracle10g.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-oracle.sql similarity index 55% rename from spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-oracle10g.sql rename to spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-oracle.sql index cfb68b5bc4..55c72d9705 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-oracle10g.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-oracle.sql @@ -1,7 +1,11 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 ; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX ; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX ; DROP TABLE INT_MESSAGE ; DROP TABLE INT_MESSAGE_GROUP ; DROP TABLE INT_GROUP_TO_MESSAGE ; DROP TABLE INT_LOCK ; -DROP INDEX INT_MESSAGE_IX1 ; +DROP TABLE INT_CHANNEL_MESSAGE ; + DROP SEQUENCE INT_MESSAGE_SEQ ; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-postgresql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-postgresql.sql index cfb68b5bc4..55c72d9705 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-postgresql.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-postgresql.sql @@ -1,7 +1,11 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 ; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX ; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX ; DROP TABLE INT_MESSAGE ; DROP TABLE INT_MESSAGE_GROUP ; DROP TABLE INT_GROUP_TO_MESSAGE ; DROP TABLE INT_LOCK ; -DROP INDEX INT_MESSAGE_IX1 ; +DROP TABLE INT_CHANNEL_MESSAGE ; + DROP SEQUENCE INT_MESSAGE_SEQ ; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sqlserver.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sqlserver.sql index cfb68b5bc4..55c72d9705 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sqlserver.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sqlserver.sql @@ -1,7 +1,11 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 ; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX ; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX ; DROP TABLE INT_MESSAGE ; DROP TABLE INT_MESSAGE_GROUP ; DROP TABLE INT_GROUP_TO_MESSAGE ; DROP TABLE INT_LOCK ; -DROP INDEX INT_MESSAGE_IX1 ; +DROP TABLE INT_CHANNEL_MESSAGE ; + DROP SEQUENCE INT_MESSAGE_SEQ ; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sybase.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sybase.sql index cfb68b5bc4..55c72d9705 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sybase.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-drop-sybase.sql @@ -1,7 +1,11 @@ --- Autogenerated: do not edit this file - +-- Autogenerated: do not edit this file + +DROP INDEX INT_MESSAGE_IX1 ; +DROP INDEX INT_CHANNEL_MSG_DATE_IDX ; +DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX ; DROP TABLE INT_MESSAGE ; DROP TABLE INT_MESSAGE_GROUP ; DROP TABLE INT_GROUP_TO_MESSAGE ; DROP TABLE INT_LOCK ; -DROP INDEX INT_MESSAGE_IX1 ; +DROP TABLE INT_CHANNEL_MESSAGE ; + DROP SEQUENCE INT_MESSAGE_SEQ ; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-h2.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-h2.sql index 9e65493c8b..298dbcabbc 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-h2.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-h2.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ); + +CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1; + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL , + MESSAGE_BYTES LONGVARBINARY, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +); + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-hsqldb.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-hsqldb.sql index 9e65493c8b..7b74fbe416 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-hsqldb.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-hsqldb.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ); + +CREATE SEQUENCE INT_MESSAGE_SEQ AS BIGINT START WITH 1 INCREMENT BY 1; + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL , + MESSAGE_BYTES LONGVARBINARY, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +); + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-mysql-5_6_4.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-mysql-5_6_4.sql deleted file mode 100644 index a55cdd1f38..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-mysql-5_6_4.sql +++ /dev/null @@ -1,37 +0,0 @@ --- Autogenerated: do not edit this file - -CREATE TABLE INT_MESSAGE ( - MESSAGE_ID CHAR(36), - REGION VARCHAR(100), - CREATED_DATE DATETIME(6) NOT NULL, - MESSAGE_BYTES BLOB, - constraint MESSAGE_PK primary key (MESSAGE_ID, REGION) -) ENGINE=InnoDB; - -CREATE INDEX INT_MESSAGE_IX1 ON INT_MESSAGE (CREATED_DATE); - -CREATE TABLE INT_GROUP_TO_MESSAGE ( - GROUP_KEY CHAR(36), - MESSAGE_ID CHAR(36), - REGION VARCHAR(100), - constraint GROUP_TO_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) -) ENGINE=InnoDB; - -CREATE TABLE INT_MESSAGE_GROUP ( - GROUP_KEY CHAR(36), - REGION VARCHAR(100), - MARKED BIGINT, - COMPLETE BIGINT, - LAST_RELEASED_SEQUENCE BIGINT, - CREATED_DATE DATETIME(6) NOT NULL, - UPDATED_DATE DATETIME(6) DEFAULT NULL, - constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION) -) ENGINE=InnoDB; - -CREATE TABLE INT_LOCK ( - LOCK_KEY CHAR(36), - REGION VARCHAR(100), - CLIENT_ID CHAR(36), - CREATED_DATE DATETIME(6) NOT NULL, - constraint LOCK_PK primary key (LOCK_KEY, REGION) -) ENGINE=InnoDB; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-mysql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-mysql.sql index 336768179c..123fd295f1 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-mysql.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-mysql.sql @@ -3,7 +3,7 @@ CREATE TABLE INT_MESSAGE ( MESSAGE_ID CHAR(36), REGION VARCHAR(100), - CREATED_DATE DATETIME NOT NULL, + CREATED_DATE DATETIME(6) NOT NULL, MESSAGE_BYTES BLOB, constraint MESSAGE_PK primary key (MESSAGE_ID, REGION) ) ENGINE=InnoDB; @@ -23,8 +23,8 @@ CREATE TABLE INT_MESSAGE_GROUP ( MARKED BIGINT, COMPLETE BIGINT, LAST_RELEASED_SEQUENCE BIGINT, - CREATED_DATE DATETIME NOT NULL, - UPDATED_DATE DATETIME DEFAULT NULL, + CREATED_DATE DATETIME(6) NOT NULL, + UPDATED_DATE DATETIME(6) DEFAULT NULL, constraint MESSAGE_GROUP_PK primary key (GROUP_KEY, REGION) ) ENGINE=InnoDB; @@ -32,6 +32,22 @@ CREATE TABLE INT_LOCK ( LOCK_KEY CHAR(36), REGION VARCHAR(100), CLIENT_ID CHAR(36), - CREATED_DATE DATETIME NOT NULL, + CREATED_DATE DATETIME(6) NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ) ENGINE=InnoDB; + + + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL AUTO_INCREMENT UNIQUE, + MESSAGE_BYTES BLOB, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +) ENGINE=InnoDB; + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-oracle10g.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-oracle.sql similarity index 59% rename from spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-oracle10g.sql rename to spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-oracle.sql index 1641269a7c..9eeef49c25 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-oracle10g.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-oracle.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ); + +CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE; + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE NUMBER(19,0) NOT NULL, + MESSAGE_PRIORITY NUMBER(19,0), + MESSAGE_SEQUENCE NUMBER(19,0) NOT NULL , + MESSAGE_BYTES BLOB, + REGION VARCHAR2(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +); + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-postgresql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-postgresql.sql index 036c497b3e..97d4f69c56 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-postgresql.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-postgresql.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE TIMESTAMP NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ); + +CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CYCLE; + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL DEFAULT nextval('INT_MESSAGE_SEQ'), + MESSAGE_BYTES BYTEA, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +); + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sqlserver.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sqlserver.sql index f51739ae08..7741ef3e15 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sqlserver.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sqlserver.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE DATETIME NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ); + +CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CACHE NO CYCLE; + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL , + MESSAGE_BYTES IMAGE, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +); + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sybase.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sybase.sql index 327770804a..65f2048c54 100644 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sybase.sql +++ b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/schema-sybase.sql @@ -35,3 +35,19 @@ CREATE TABLE INT_LOCK ( CREATED_DATE DATETIME NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) ) LOCK DATAROWS; + +CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CACHE NO CYCLE; + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE BIGINT NOT NULL, + MESSAGE_PRIORITY BIGINT, + MESSAGE_SEQUENCE BIGINT NOT NULL , + MESSAGE_BYTES IMAGE, + REGION VARCHAR(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +) LOCK DATAROWS; + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-derby.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-derby.sql deleted file mode 100644 index f62b27367c..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-derby.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE INT_CHANNEL_MESSAGE ( - MESSAGE_ID CHAR(36) NOT NULL, - GROUP_KEY CHAR(36) NOT NULL, - CREATED_DATE BIGINT NOT NULL, - MESSAGE_PRIORITY INT, - MESSAGE_SEQUENCE BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), - MESSAGE_BYTES BLOB, - REGION VARCHAR(100) NOT NULL, - constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) -); - -CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); -CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-derby.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-derby.sql deleted file mode 100644 index 9a37bb5670..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-derby.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE INT_CHANNEL_MESSAGE; -DROP INDEX INT_CHANNEL_MSG_DATE_IDX; -DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX; - diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-h2.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-h2.sql deleted file mode 100644 index 257045f2f4..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-h2.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE INT_CHANNEL_MESSAGE; -DROP INDEX INT_CHANNEL_MSG_DATE_IDX; -DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX; -DROP SEQUENCE INT_MESSAGE_SEQ; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-hsql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-hsql.sql deleted file mode 100644 index 257045f2f4..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-hsql.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE INT_CHANNEL_MESSAGE; -DROP INDEX INT_CHANNEL_MSG_DATE_IDX; -DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX; -DROP SEQUENCE INT_MESSAGE_SEQ; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-mysql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-mysql.sql deleted file mode 100644 index b83c9dce6e..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-mysql.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP TABLE INT_CHANNEL_MESSAGE; - diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-oracle.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-oracle.sql deleted file mode 100644 index f907782103..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-oracle.sql +++ /dev/null @@ -1,5 +0,0 @@ -DROP INDEX INT_CHANNEL_MSG_DATE_IDX; -DROP TABLE INT_CHANNEL_MESSAGE; -DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX; -DROP SEQUENCE INT_MESSAGE_SEQ; - diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-postgres.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-postgres.sql deleted file mode 100644 index ec9ec7b33a..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-drop-postgres.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP INDEX INT_CHANNEL_MSG_DATE_IDX; -DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX; -DROP TABLE INT_CHANNEL_MESSAGE; -DROP SEQUENCE INT_MESSAGE_SEQ; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-h2.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-h2.sql deleted file mode 100644 index 0223a63928..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-h2.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE INT_CHANNEL_MESSAGE ( - MESSAGE_ID CHAR(36) NOT NULL, - GROUP_KEY CHAR(36) NOT NULL, - CREATED_DATE BIGINT NOT NULL, - MESSAGE_PRIORITY INT, - MESSAGE_SEQUENCE BIGINT NOT NULL, - MESSAGE_BYTES LONGVARBINARY, - REGION VARCHAR(100) NOT NULL, - constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) -); - -CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); -CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); - -CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-hsql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-hsql.sql deleted file mode 100644 index 2f475e9089..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-hsql.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE INT_CHANNEL_MESSAGE ( - MESSAGE_ID CHAR(36) NOT NULL, - GROUP_KEY CHAR(36) NOT NULL, - CREATED_DATE BIGINT NOT NULL, - MESSAGE_PRIORITY INT, - MESSAGE_SEQUENCE BIGINT NOT NULL, - MESSAGE_BYTES LONGVARBINARY, - REGION VARCHAR(100) NOT NULL, - constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) -); - -CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); -CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); - -CREATE SEQUENCE INT_MESSAGE_SEQ AS BIGINT START WITH 1 INCREMENT BY 1; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-mysql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-mysql.sql deleted file mode 100644 index 1989e4872c..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-mysql.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE INT_CHANNEL_MESSAGE ( - MESSAGE_ID CHAR(36) NOT NULL, - GROUP_KEY CHAR(36) NOT NULL, - CREATED_DATE BIGINT NOT NULL, - MESSAGE_PRIORITY INT, - MESSAGE_SEQUENCE BIGINT AUTO_INCREMENT UNIQUE, - MESSAGE_BYTES BLOB, - REGION VARCHAR(100) NOT NULL, - constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) -) ENGINE=InnoDB; - -ALTER TABLE INT_CHANNEL_MESSAGE -ADD INDEX MSG_INDEX_DATE_IDX USING BTREE (CREATED_DATE, MESSAGE_SEQUENCE); - -ALTER TABLE INT_CHANNEL_MESSAGE -ADD INDEX MSG_INDEX_PRIORITY_IDX USING BTREE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-oracle.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-oracle.sql deleted file mode 100644 index d384813e2f..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-oracle.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE INT_CHANNEL_MESSAGE ( - MESSAGE_ID CHAR(36) NOT NULL, - GROUP_KEY CHAR(36) NOT NULL, - CREATED_DATE NUMBER(19,0) NOT NULL, - MESSAGE_PRIORITY NUMBER, - MESSAGE_SEQUENCE NUMBER NOT NULL, - MESSAGE_BYTES BLOB, - REGION VARCHAR2(100) NOT NULL, - constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) -); - -CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); -CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); - -CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE; diff --git a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-postgresql.sql b/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-postgresql.sql deleted file mode 100644 index 35c6f19e25..0000000000 --- a/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/store/channel/schema-postgresql.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CYCLE; - -CREATE TABLE INT_CHANNEL_MESSAGE ( - MESSAGE_ID character(36) NOT NULL, - GROUP_KEY character(36) NOT NULL, - CREATED_DATE BIGINT NOT NULL, - MESSAGE_PRIORITY INT, - MESSAGE_SEQUENCE BIGINT NOT NULL DEFAULT nextval('INT_MESSAGE_SEQ'), - MESSAGE_BYTES bytea, - REGION character varying(100) NOT NULL, - constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) -); - -CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE USING btree (CREATED_DATE, MESSAGE_SEQUENCE); -CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE USING btree (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/sql/db2.properties b/spring-integration-jdbc/src/main/sql/db2.properties index 4e659c3016..d842186236 100644 --- a/spring-integration-jdbc/src/main/sql/db2.properties +++ b/spring-integration-jdbc/src/main/sql/db2.properties @@ -9,3 +9,4 @@ TIMESTAMP = TIMESTAMP VARCHAR = VARCHAR # for generating drop statements... SEQUENCE = SEQUENCE +INT_MESSAGE_SEQ = CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CACHE NO CYCLE; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/derby.properties b/spring-integration-jdbc/src/main/sql/derby.properties index 714a1d1729..c917ff7bfa 100644 --- a/spring-integration-jdbc/src/main/sql/derby.properties +++ b/spring-integration-jdbc/src/main/sql/derby.properties @@ -10,3 +10,4 @@ TIMESTAMP = TIMESTAMP VARCHAR = VARCHAR # for generating drop statements... SEQUENCE = TABLE +AUTO_INCREMENT = GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/destroy.sql.vpp b/spring-integration-jdbc/src/main/sql/destroy.sql.vpp index ab382a93a9..1d8f750d10 100644 --- a/spring-integration-jdbc/src/main/sql/destroy.sql.vpp +++ b/spring-integration-jdbc/src/main/sql/destroy.sql.vpp @@ -1,5 +1,9 @@ +DROP INDEX $!{IFEXISTSBEFORE} INT_MESSAGE_IX1 $!{IFEXISTS}; +DROP INDEX $!{IFEXISTSBEFORE} INT_CHANNEL_MSG_DATE_IDX $!{IFEXISTS}; +DROP INDEX $!{IFEXISTSBEFORE} INT_CHANNEL_MSG_PRIORITY_IDX $!{IFEXISTS}; DROP TABLE $!{IFEXISTSBEFORE} INT_MESSAGE $!{IFEXISTS}; DROP TABLE $!{IFEXISTSBEFORE} INT_MESSAGE_GROUP $!{IFEXISTS}; DROP TABLE $!{IFEXISTSBEFORE} INT_GROUP_TO_MESSAGE $!{IFEXISTS}; DROP TABLE $!{IFEXISTSBEFORE} INT_LOCK $!{IFEXISTS}; -DROP INDEX $!{IFEXISTSBEFORE} INT_MESSAGE_IX1 $!{IFEXISTS}; +DROP TABLE $!{IFEXISTSBEFORE} INT_CHANNEL_MESSAGE $!{IFEXISTS}; +#if(${INT_MESSAGE_SEQ}) DROP SEQUENCE INT_MESSAGE_SEQ $!{IFEXISTS};#end diff --git a/spring-integration-jdbc/src/main/sql/h2.properties b/spring-integration-jdbc/src/main/sql/h2.properties index 76afa046fa..13615aa646 100644 --- a/spring-integration-jdbc/src/main/sql/h2.properties +++ b/spring-integration-jdbc/src/main/sql/h2.properties @@ -10,3 +10,4 @@ TIMESTAMP = TIMESTAMP VARCHAR = VARCHAR # for generating drop statements... SEQUENCE = SEQUENCE +INT_MESSAGE_SEQ = CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/hsqldb.properties b/spring-integration-jdbc/src/main/sql/hsqldb.properties index 8cf391d9ea..c38d24a1d4 100644 --- a/spring-integration-jdbc/src/main/sql/hsqldb.properties +++ b/spring-integration-jdbc/src/main/sql/hsqldb.properties @@ -10,3 +10,4 @@ TIMESTAMP = TIMESTAMP VARCHAR = VARCHAR # for generating drop statements... SEQUENCE = TABLE +INT_MESSAGE_SEQ = CREATE SEQUENCE INT_MESSAGE_SEQ AS BIGINT START WITH 1 INCREMENT BY 1; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/mysql-5_6_4.properties b/spring-integration-jdbc/src/main/sql/mysql-5_6_4.properties deleted file mode 100644 index 1a5c2c4046..0000000000 --- a/spring-integration-jdbc/src/main/sql/mysql-5_6_4.properties +++ /dev/null @@ -1,14 +0,0 @@ -platform=mysql -# SQL language oddities -BIGINT = BIGINT -IDENTITY = -GENERATED = -VOODOO = ENGINE=InnoDB -IFEXISTSBEFORE = IF EXISTS -DOUBLE = DOUBLE PRECISION -BLOB = BLOB -CLOB = TEXT -TIMESTAMP = DATETIME(6) -VARCHAR = VARCHAR -# for generating drop statements... -SEQUENCE = TABLE diff --git a/spring-integration-jdbc/src/main/sql/mysql-5_6_4.vpp b/spring-integration-jdbc/src/main/sql/mysql-5_6_4.vpp deleted file mode 100644 index fd65fad6e3..0000000000 --- a/spring-integration-jdbc/src/main/sql/mysql-5_6_4.vpp +++ /dev/null @@ -1,4 +0,0 @@ -#macro (sequence $name $value)CREATE TABLE ${name} (ID BIGINT NOT NULL) ENGINE=MYISAM; -INSERT INTO ${name} values(0); -#end -#macro (notnull $name $type)MODIFY COLUMN ${name} ${type} NOT NULL#end diff --git a/spring-integration-jdbc/src/main/sql/mysql.properties b/spring-integration-jdbc/src/main/sql/mysql.properties index 470ca6bc1d..1b18e55577 100644 --- a/spring-integration-jdbc/src/main/sql/mysql.properties +++ b/spring-integration-jdbc/src/main/sql/mysql.properties @@ -1,14 +1,15 @@ -platform=oracle10g +platform=mysql # SQL language oddities BIGINT = BIGINT -IDENTITY = -GENERATED = +IDENTITY = +GENERATED = VOODOO = ENGINE=InnoDB IFEXISTSBEFORE = IF EXISTS DOUBLE = DOUBLE PRECISION BLOB = BLOB CLOB = TEXT -TIMESTAMP = DATETIME +TIMESTAMP = DATETIME(6) VARCHAR = VARCHAR # for generating drop statements... SEQUENCE = TABLE +AUTO_INCREMENT = AUTO_INCREMENT UNIQUE \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/oracle10g.properties b/spring-integration-jdbc/src/main/sql/oracle.properties similarity index 65% rename from spring-integration-jdbc/src/main/sql/oracle10g.properties rename to spring-integration-jdbc/src/main/sql/oracle.properties index 64ffa268e4..5b60d58897 100644 --- a/spring-integration-jdbc/src/main/sql/oracle10g.properties +++ b/spring-integration-jdbc/src/main/sql/oracle.properties @@ -1,4 +1,4 @@ -platform=oracle10g +platform=oracle # SQL language oddities BIGINT = NUMBER(19\,0) IDENTITY = @@ -10,3 +10,4 @@ TIMESTAMP = TIMESTAMP VARCHAR = VARCHAR2 # for generating drop statements... SEQUENCE = SEQUENCE +INT_MESSAGE_SEQ = CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NOCACHE NOCYCLE; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/oracle10g.vpp b/spring-integration-jdbc/src/main/sql/oracle.vpp similarity index 100% rename from spring-integration-jdbc/src/main/sql/oracle10g.vpp rename to spring-integration-jdbc/src/main/sql/oracle.vpp diff --git a/spring-integration-jdbc/src/main/sql/postgresql.properties b/spring-integration-jdbc/src/main/sql/postgresql.properties index 8d51883a71..6807aa5df4 100644 --- a/spring-integration-jdbc/src/main/sql/postgresql.properties +++ b/spring-integration-jdbc/src/main/sql/postgresql.properties @@ -10,3 +10,5 @@ TIMESTAMP = TIMESTAMP VARCHAR = VARCHAR # for generating drop statements... SEQUENCE = SEQUENCE +AUTO_INCREMENT = DEFAULT nextval('INT_MESSAGE_SEQ') +INT_MESSAGE_SEQ = CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CYCLE; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/schema.sql.vpp b/spring-integration-jdbc/src/main/sql/schema.sql.vpp index 6b23674326..9707e3855c 100644 --- a/spring-integration-jdbc/src/main/sql/schema.sql.vpp +++ b/spring-integration-jdbc/src/main/sql/schema.sql.vpp @@ -35,3 +35,20 @@ CREATE TABLE INT_LOCK ( CREATED_DATE ${TIMESTAMP} NOT NULL, constraint LOCK_PK primary key (LOCK_KEY, REGION) )#if(${VOODOO}) ${VOODOO}#end; + +#if(${INT_MESSAGE_SEQ})${INT_MESSAGE_SEQ}#end + + +CREATE TABLE INT_CHANNEL_MESSAGE ( + MESSAGE_ID CHAR(36) NOT NULL, + GROUP_KEY CHAR(36) NOT NULL, + CREATED_DATE ${BIGINT} NOT NULL, + MESSAGE_PRIORITY ${BIGINT}, + MESSAGE_SEQUENCE ${BIGINT} NOT NULL #if(${AUTO_INCREMENT})${AUTO_INCREMENT}#end, + MESSAGE_BYTES ${BLOB}, + REGION ${VARCHAR}(100) NOT NULL, + constraint INT_CHANNEL_MESSAGE_PK primary key (GROUP_KEY, MESSAGE_ID, REGION) +)#if(${VOODOO}) ${VOODOO}#end; + +CREATE INDEX INT_CHANNEL_MSG_DATE_IDX ON INT_CHANNEL_MESSAGE (CREATED_DATE, MESSAGE_SEQUENCE); +CREATE INDEX INT_CHANNEL_MSG_PRIORITY_IDX ON INT_CHANNEL_MESSAGE (MESSAGE_PRIORITY DESC, CREATED_DATE, MESSAGE_SEQUENCE); diff --git a/spring-integration-jdbc/src/main/sql/sqlserver.properties b/spring-integration-jdbc/src/main/sql/sqlserver.properties index 60b6aa24e2..9d9fc60d7b 100644 --- a/spring-integration-jdbc/src/main/sql/sqlserver.properties +++ b/spring-integration-jdbc/src/main/sql/sqlserver.properties @@ -9,3 +9,4 @@ TIMESTAMP = DATETIME VARCHAR = VARCHAR # for generating drop statements... SEQUENCE = TABLE +INT_MESSAGE_SEQ = CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CACHE NO CYCLE; \ No newline at end of file diff --git a/spring-integration-jdbc/src/main/sql/sybase.properties b/spring-integration-jdbc/src/main/sql/sybase.properties index 5e9c2c5e5d..f5a8e9a2ae 100644 --- a/spring-integration-jdbc/src/main/sql/sybase.properties +++ b/spring-integration-jdbc/src/main/sql/sybase.properties @@ -11,3 +11,4 @@ NULL = NULL # for generating drop statements... SEQUENCE = TABLE VOODOO = LOCK DATAROWS +INT_MESSAGE_SEQ = CREATE SEQUENCE INT_MESSAGE_SEQ START WITH 1 INCREMENT BY 1 NO CACHE NO CYCLE; \ No newline at end of file diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests-context.xml index 9fef2edb78..e9659ba133 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests-context.xml @@ -7,7 +7,8 @@ http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd"> + class="org.springframework.integration.jdbc.store.JdbcMessageStore"> + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests.java index 9685c6919f..c2b0b0b18b 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/DelayerHandlerRescheduleIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -172,15 +172,6 @@ public class DelayerHandlerRescheduleIntegrationTests { context.close(); } - @SuppressWarnings("unused") - private static class TestJdbcMessageStore extends JdbcMessageStore { - - TestJdbcMessageStore() { - this.setDataSource(dataSource); - } - - } - @SuppressWarnings("unused") private static class ExceptionMessageHandler implements MessageHandler { diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParserTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParserTests.java index 835adbc6eb..faae0871e0 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParserTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/JdbcMessageStoreParserTests.java @@ -31,7 +31,7 @@ import org.springframework.core.serializer.DefaultSerializer; import org.springframework.core.serializer.Deserializer; import org.springframework.core.serializer.Serializer; import org.springframework.messaging.Message; -import org.springframework.integration.jdbc.JdbcMessageStore; +import org.springframework.integration.jdbc.store.JdbcMessageStore; import org.springframework.integration.store.MessageStore; import org.springframework.integration.support.MessageBuilder; import org.springframework.integration.test.util.TestUtils; diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java index 00ca15b4bb..8433014397 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java @@ -44,7 +44,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.history.MessageHistory; -import org.springframework.integration.jdbc.JdbcMessageStore; +import org.springframework.integration.jdbc.store.JdbcMessageStore; +import org.springframework.integration.jdbc.store.JdbcMessageStoreTests; import org.springframework.integration.store.MessageGroup; import org.springframework.integration.support.MessageBuilder; import org.springframework.integration.util.UUIDConverter; @@ -64,7 +65,7 @@ import org.springframework.transaction.support.TransactionTemplate; /** * Based on the test for Derby: * - * {@link org.springframework.integration.jdbc.JdbcMessageStoreTests} + * {@link JdbcMessageStoreTests} * * This tests requires at least MySql 5.6.4 as it uses the fractional second support * in that version. For more information, please see: diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelIntegrationTests-context.xml similarity index 94% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests-context.xml rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelIntegrationTests-context.xml index 9de7188e78..cdb90f40d7 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelIntegrationTests-context.xml @@ -1,74 +1,74 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelIntegrationTests.java similarity index 99% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests.java rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelIntegrationTests.java index 193f37ac1d..1287287362 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.jdbc; +package org.springframework.integration.jdbc.store; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.instanceOf; diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelOnePollerIntegrationTests-context.xml similarity index 93% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests-context.xml rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelOnePollerIntegrationTests-context.xml index 583f07ce63..4305003fd6 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelOnePollerIntegrationTests-context.xml @@ -1,64 +1,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelOnePollerIntegrationTests.java similarity index 98% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests.java rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelOnePollerIntegrationTests.java index 453e249c40..a90def26f5 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelOnePollerIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.jdbc; +package org.springframework.integration.jdbc.store; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelTests-context.xml similarity index 96% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelTests-context.xml index 4bc2294e0e..b1d5c74a1b 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelTests-context.xml @@ -40,7 +40,7 @@ - + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelTests.java similarity index 97% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelTests.java index 9832014320..96f25b8ec2 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreChannelTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.jdbc; +package org.springframework.integration.jdbc.store; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -26,10 +26,11 @@ import java.util.concurrent.TimeUnit; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.integration.store.MessageGroup; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.GenericMessage; -import org.springframework.integration.store.MessageGroup; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreRegionTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreRegionTests.java similarity index 98% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreRegionTests.java rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreRegionTests.java index f5e324faf1..9920c2723f 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreRegionTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreRegionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.jdbc; +package org.springframework.integration.jdbc.store; import static org.junit.Assert.assertEquals; diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreTests-context.xml similarity index 97% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests-context.xml rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreTests-context.xml index 8d8db79285..83887861fc 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreTests-context.xml @@ -1,26 +1,26 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreTests.java similarity index 99% rename from spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests.java rename to spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreTests.java index 053cf80116..abdc156cb8 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/JdbcMessageStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.jdbc; +package org.springframework.integration.jdbc.store; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml index 8e6a6130c4..2e1e941eae 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml @@ -24,7 +24,7 @@ /> --> - + - - + + - - + + diff --git a/src/reference/asciidoc/aggregator.adoc b/src/reference/asciidoc/aggregator.adoc index 3776f8f830..cc8a5c22e3 100644 --- a/src/reference/asciidoc/aggregator.adoc +++ b/src/reference/asciidoc/aggregator.adoc @@ -334,7 +334,7 @@ Below you can see an example of an aggregator. - + diff --git a/src/reference/asciidoc/jdbc.adoc b/src/reference/asciidoc/jdbc.adoc index 44914bea5d..ef38b4b42d 100644 --- a/src/reference/asciidoc/jdbc.adoc +++ b/src/reference/asciidoc/jdbc.adoc @@ -323,23 +323,6 @@ Here we have specified a `LobHandler` for dealing with messages as large objects often necessary if using Oracle) and a prefix for the table names in the queries generated by the store. The table name prefix defaults to `INT_`. -[NOTE] -===== -If you plan on using *MySQL*, please use MySQL version _5.6.4_ or higher, if possible. -Prior versions do not support _fractional seconds_ for temporal data types. -Because of that, messages may not arrive in the precise FIFO order when polling from such a MySQL Message Store. - -Therefore, starting with _Spring Integration 3.0_, we provide an additional set of DDL scripts for MySQL version _5.6.4_ or higher: - -* schema-drop-mysql-5_6_4.sql -* schema-mysql-5_6_4.sql - -For more information, please see: https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html[Fractional Seconds in Time Values]. - -Also important, please ensure that you use an up-to-date version of the JDBC driver for MySQL (Connector/J), e.g. -version _5.1.24_ or higher. -===== - [[jdbc-message-store-channels]] ==== Backing Message Channels @@ -358,7 +341,9 @@ This `channelMessageStoreQueryProvider` provides the SQL queries and Spring Inte * Oracle * Derby * H2 - +* SqlServer +* Sybase +* DB2 If your database is not listed, you can easily extend the `AbstractChannelMessageStoreQueryProvider` class and provide your own custom queries. @@ -390,7 +375,6 @@ To achieve better JDBC queue throughput, and avoid issues when different threads [source,xml] ---- -… @@ -422,7 +406,6 @@ To achieve better JDBC queue throughput, and avoid issues when different threads -… ---- *Priority Channel* @@ -460,11 +443,10 @@ To configure that scenario, simply extend one message store bean from the other: ==== Initializing the Database Spring Integration ships with some sample scripts that can be used to initialize a database. -In the spring-integration-jdbc JAR file you will find scripts in the `org.springframework.integration.jdbc` and in the `org.springframework.integration.jdbc.store.channel` package: there is a create and a drop script example for a range of common database platforms. +In the `spring-integration-jdbc` JAR file you can find scripts in the `org.springframework.integration.jdbc` package: there is a create and a drop script example for a range of common database platforms. A common way to use these scripts is to reference them in a https://docs.spring.io/spring/docs/current/spring-framework-reference/html/jdbc.html#jdbc-intializing-datasource[Spring JDBC data source initializer]. -Note that the scripts are provided as samples or specifications of the the required table and column names. -You may find that you need to enhance them for production use (e.g. -with index declarations). +`Note that the scripts are provided as samples or specifications of the the required table and column names. +You may find that you need to enhance them for production use (e.g. with index declarations). ==== Partitioning a Message Store