INT-4050: Refactoring for JDBC Schema Scripts
JIRA: https://jira.spring.io/browse/INT-2625, https://jira.spring.io/browse/INT-4050, https://jira.spring.io/browse/INT-4052 Make some refactoring for consistency: - Move `JdbcMessageStore` to the `store` package - Make `JdbcMessageStore` only ctor-based configuration for the `JdbcOperations` - Remove `/channel/` SQL scripts in favor of combined in the `/jdbc/` directory - Make scripts for the `INT_CHANNEL_MESSAGE` table and indexes generated via VPP Fix drop script generation Fix `schema-derby.sql` for suspicious `[]` Looks like `foundrylogic.vpp` tool generates somehow wrong SQL Further fix for the `drop` scripts generation Address PR comments: * Remove deprecated code in the `JdbcMessageStore` * Remove separate MySQL script in favor of only one for latest version * Remove the note in the `jdbc.adoc` about recommendation to use new MySQL version
This commit is contained in:
committed by
Gary Russell
parent
34db64c832
commit
5224779a04
@@ -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 {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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.
|
||||
* </p>
|
||||
*
|
||||
|
||||
@@ -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 <code>org/springframework/integration/jdbc/schema-*.sql</code>, where <code>*</code> is the
|
||||
* target database type.
|
||||
* <p>
|
||||
* Notice: Starting with Spring Integration 5.0, this class will move to package:
|
||||
* {@code org.springframework.integration.jdbc.store}.
|
||||
* <p>
|
||||
* 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 <aggregator>}),
|
||||
@@ -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<Query, String> queryCache = new HashMap<Query, String>();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ;
|
||||
@@ -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 ;
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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 ;
|
||||
@@ -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 ;
|
||||
|
||||
@@ -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 ;
|
||||
@@ -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 ;
|
||||
@@ -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 ;
|
||||
@@ -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 ;
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
@@ -1,4 +0,0 @@
|
||||
DROP TABLE INT_CHANNEL_MESSAGE;
|
||||
DROP INDEX INT_CHANNEL_MSG_DATE_IDX;
|
||||
DROP INDEX INT_CHANNEL_MSG_PRIORITY_IDX;
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -1,2 +0,0 @@
|
||||
DROP TABLE INT_CHANNEL_MESSAGE;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -7,7 +7,8 @@
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<beans:bean id="messageStore"
|
||||
class="org.springframework.integration.jdbc.DelayerHandlerRescheduleIntegrationTests$TestJdbcMessageStore">
|
||||
class="org.springframework.integration.jdbc.store.JdbcMessageStore">
|
||||
<beans:constructor-arg value="#{T (org.springframework.integration.jdbc.DelayerHandlerRescheduleIntegrationTests).dataSource}"/>
|
||||
<beans:property name="lazyLoadMessageGroups" value="false"/>
|
||||
</beans:bean>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
|
||||
<jdbc:script location="${int.drop.script}"/>
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int-jdbc:message-store id="messageStore" data-source="dataSource"/>
|
||||
|
||||
<channel id="input" xmlns="http://www.springframework.org/schema/integration">
|
||||
<queue ref="storeQueue"/>
|
||||
</channel>
|
||||
|
||||
<bean id="storeQueue" class="org.springframework.integration.store.MessageGroupQueue">
|
||||
<constructor-arg ref="messageStore"/>
|
||||
<constructor-arg value="JdbcMessageStoreChannelIntegrationTests"/>
|
||||
<constructor-arg ref="lock"/>
|
||||
</bean>
|
||||
|
||||
<int:channel id="output"/>
|
||||
|
||||
<int:logging-channel-adapter channel="output"/>
|
||||
|
||||
<service-activator id="service-activator"
|
||||
input-channel="input" output-channel="output"
|
||||
xmlns="http://www.springframework.org/schema/integration">
|
||||
<beans:bean
|
||||
class="org.springframework.integration.jdbc.JdbcMessageStoreChannelIntegrationTests$Service"/>
|
||||
<poller fixed-rate="200">
|
||||
<advice-chain>
|
||||
<ref bean="txAdvice"/>
|
||||
<ref bean="lock"/>
|
||||
</advice-chain>
|
||||
</poller>
|
||||
</service-activator>
|
||||
|
||||
<bean id="lock" class="org.springframework.integration.jdbc.LockInterceptor"/>
|
||||
<tx:advice id="txAdvice">
|
||||
<tx:attributes>
|
||||
<tx:method name="*"/>
|
||||
</tx:attributes>
|
||||
</tx:advice>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager"
|
||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<int:header-enricher input-channel="routingSlip" output-channel="input">
|
||||
<int:routing-slip value="@myService.nextPath(request, reply)"/>
|
||||
</int:header-enricher>
|
||||
|
||||
</beans>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
|
||||
<jdbc:script location="${int.drop.script}"/>
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int-jdbc:message-store id="messageStore" data-source="dataSource"/>
|
||||
|
||||
<channel id="input" xmlns="http://www.springframework.org/schema/integration">
|
||||
<queue ref="storeQueue"/>
|
||||
</channel>
|
||||
|
||||
<bean id="storeQueue" class="org.springframework.integration.store.MessageGroupQueue">
|
||||
<constructor-arg ref="messageStore"/>
|
||||
<constructor-arg value="JdbcMessageStoreChannelIntegrationTests"/>
|
||||
<constructor-arg ref="lock"/>
|
||||
</bean>
|
||||
|
||||
<int:channel id="output"/>
|
||||
|
||||
<int:logging-channel-adapter channel="output"/>
|
||||
|
||||
<service-activator id="service-activator"
|
||||
input-channel="input" output-channel="output"
|
||||
xmlns="http://www.springframework.org/schema/integration">
|
||||
<beans:bean
|
||||
class="org.springframework.integration.jdbc.store.JdbcMessageStoreChannelIntegrationTests$Service"/>
|
||||
<poller fixed-rate="200">
|
||||
<advice-chain>
|
||||
<ref bean="txAdvice"/>
|
||||
<ref bean="lock"/>
|
||||
</advice-chain>
|
||||
</poller>
|
||||
</service-activator>
|
||||
|
||||
<bean id="lock" class="org.springframework.integration.jdbc.LockInterceptor"/>
|
||||
<tx:advice id="txAdvice">
|
||||
<tx:attributes>
|
||||
<tx:method name="*"/>
|
||||
</tx:attributes>
|
||||
</tx:advice>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager"
|
||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<int:header-enricher input-channel="routingSlip" output-channel="input">
|
||||
<int:routing-slip value="@myService.nextPath(request, reply)"/>
|
||||
</int:header-enricher>
|
||||
|
||||
</beans>
|
||||
@@ -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;
|
||||
@@ -1,64 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY" />
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource"
|
||||
ignore-failures="DROPS">
|
||||
<jdbc:script location="${int.drop.script}" />
|
||||
<jdbc:script location="${int.schema.script}" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int-jdbc:message-store id="messageStore"
|
||||
data-source="dataSource" />
|
||||
|
||||
<channel id="relay" xmlns="http://www.springframework.org/schema/integration">
|
||||
<queue message-store="messageStore" />
|
||||
</channel>
|
||||
|
||||
<channel id="durable" xmlns="http://www.springframework.org/schema/integration">
|
||||
<queue message-store="messageStore" />
|
||||
</channel>
|
||||
|
||||
<service-activator id="service-relay" input-channel="relay"
|
||||
output-channel="durable" xmlns="http://www.springframework.org/schema/integration">
|
||||
<beans:bean
|
||||
class="org.springframework.integration.jdbc.JdbcMessageStoreChannelOnePollerIntegrationTests$Service" />
|
||||
<poller fixed-rate="200">
|
||||
<advice-chain>
|
||||
<ref bean="txAdvice" />
|
||||
<ref bean="lock" />
|
||||
</advice-chain>
|
||||
</poller>
|
||||
</service-activator>
|
||||
|
||||
<bean id="lock" class="org.springframework.integration.jdbc.LockInterceptor" />
|
||||
<tx:advice id="txAdvice">
|
||||
<tx:attributes>
|
||||
<tx:method name="*" />
|
||||
</tx:attributes>
|
||||
</tx:advice>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager"
|
||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY" />
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource"
|
||||
ignore-failures="DROPS">
|
||||
<jdbc:script location="${int.drop.script}" />
|
||||
<jdbc:script location="${int.schema.script}" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int-jdbc:message-store id="messageStore"
|
||||
data-source="dataSource" />
|
||||
|
||||
<channel id="relay" xmlns="http://www.springframework.org/schema/integration">
|
||||
<queue message-store="messageStore" />
|
||||
</channel>
|
||||
|
||||
<channel id="durable" xmlns="http://www.springframework.org/schema/integration">
|
||||
<queue message-store="messageStore" />
|
||||
</channel>
|
||||
|
||||
<service-activator id="service-relay" input-channel="relay"
|
||||
output-channel="durable" xmlns="http://www.springframework.org/schema/integration">
|
||||
<beans:bean
|
||||
class="org.springframework.integration.jdbc.store.JdbcMessageStoreChannelOnePollerIntegrationTests$Service" />
|
||||
<poller fixed-rate="200">
|
||||
<advice-chain>
|
||||
<ref bean="txAdvice" />
|
||||
<ref bean="lock" />
|
||||
</advice-chain>
|
||||
</poller>
|
||||
</service-activator>
|
||||
|
||||
<bean id="lock" class="org.springframework.integration.jdbc.LockInterceptor" />
|
||||
<tx:advice id="txAdvice">
|
||||
<tx:attributes>
|
||||
<tx:method name="*" />
|
||||
</tx:attributes>
|
||||
</tx:advice>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager"
|
||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -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;
|
||||
@@ -40,7 +40,7 @@
|
||||
</bean>
|
||||
|
||||
<service-activator id="service-activator" input-channel="input" output-channel="output" xmlns="http://www.springframework.org/schema/integration">
|
||||
<beans:bean class="org.springframework.integration.jdbc.JdbcMessageStoreChannelTests$Service" />
|
||||
<beans:bean class="org.springframework.integration.jdbc.store.JdbcMessageStoreChannelTests$Service" />
|
||||
<poller fixed-rate="2000">
|
||||
<transactional />
|
||||
</poller>
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
|
||||
<jdbc:script location="${int.drop.script}"/>
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
|
||||
<jdbc:script location="${int.drop.script}"/>
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -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;
|
||||
@@ -24,7 +24,7 @@
|
||||
/> </bean> -->
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/store/channel/schema-derby.sql" />
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-derby.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<bean id="queryProvider"
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
</bean>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/store/channel/schema-drop-h2.sql" />
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/store/channel/schema-h2.sql" />
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-drop-h2.sql" />
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-h2.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<bean id="queryProvider"
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
</bean>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/store/channel/schema-drop-hsql.sql"/>
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/store/channel/schema-hsql.sql"/>
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-drop-hsqldb.sql"/>
|
||||
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-hsqldb.sql"/>
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<bean id="queryProvider" class="org.springframework.integration.jdbc.store.channel.HsqlChannelMessageStoreQueryProvider"/>
|
||||
|
||||
@@ -334,7 +334,7 @@ Below you can see an example of an aggregator.
|
||||
|
||||
<int:channel id="throwAwayChannel"/>
|
||||
|
||||
<bean id="persistentMessageStore" class="org.springframework.integration.jdbc.JdbcMessageStore">
|
||||
<bean id="persistentMessageStore" class="org.springframework.integration.jdbc.store.JdbcMessageStore">
|
||||
<constructor-arg ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -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]
|
||||
----
|
||||
…
|
||||
<bean id="queryProvider"
|
||||
class="o.s.i.jdbc.store.channel.PostgresChannelMessageStoreQueryProvider"/>
|
||||
|
||||
@@ -422,7 +406,6 @@ To achieve better JDBC queue throughput, and avoid issues when different threads
|
||||
</int:bridge>
|
||||
|
||||
<int:channel id="outputChannel" />
|
||||
…
|
||||
----
|
||||
|
||||
*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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user