日期:2014-05-16 浏览次数:20424 次
?????? 最近有网友问我,ActiveMQ持久化的中表结构是什么,表需要人工创建吗?我告诉他们不需要,ActiveMQ会帮助我们生成的。只需要制定采用的数据库名称并,创建数据库即可。以为为ActiveMQ采用MySQL5.1持久化产生的SQL语句:
持久化的代码实现为:
http://topmanopensource.iteye.com/blog/1066383
持久化mysql数据库的3张表;
activemq_acks:ActiveMQ的签收信息。
activemq_lock:ActiveMQ的锁信息。
activemq_msgs:ActiveMQ的消息的信息
# MySQL-Front 5.1 (Build 4.2) /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE */; /*!40101 SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES */; /*!40103 SET SQL_NOTES='ON' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS */; /*!40014 SET UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=0 */; # Host: localhost Database: activemq # ------------------------------------------------------ # Server version 5.1.40-community DROP DATABASE IF EXISTS `activemq`; CREATE DATABASE `activemq` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `activemq`; # # Source for table activemq_acks # DROP TABLE IF EXISTS `activemq_acks`; CREATE TABLE `activemq_acks` ( `CONTAINER` varchar(250) NOT NULL, `SUB_DEST` varchar(250) DEFAULT NULL, `CLIENT_ID` varchar(250) NOT NULL, `SUB_NAME` varchar(250) NOT NULL, `SELECTOR` varchar(250) DEFAULT NULL, `LAST_ACKED_ID` bigint(20) DEFAULT NULL, `PRIORITY` bigint(20) NOT NULL DEFAULT '5', PRIMARY KEY (`CONTAINER`,`CLIENT_ID`,`SUB_NAME`,`PRIORITY`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # # Dumping data for table activemq_acks # LOCK TABLES `activemq_acks` WRITE; /*!40000 ALTER TABLE `activemq_acks` DISABLE KEYS */; /*!40000 ALTER TABLE `activemq_acks` ENABLE KEYS */; UNLOCK TABLES; # # Source for table activemq_lock # DROP TABLE IF EXISTS `activemq_lock`; CREATE TABLE `activemq_lock` ( `ID` bigint(20) NOT NULL, `TIME` bigint(20) DEFAULT NULL, `BROKER_NAME` varchar(250) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # # Dumping data for table activemq_lock # LOCK TABLES `activemq_lock` WRITE; /*!40000 ALTER TABLE `activemq_lock` DISABLE KEYS */; INSERT INTO `activemq_lock` VALUES (1,NULL,NULL); /*!40000 ALTER TABLE `activemq_lock` ENABLE KEYS */; UNLOCK TABLES; # # Source for table activemq_msgs # DROP TABLE IF EXISTS `activemq_msgs`; CREATE TABLE `activemq_msgs` ( `ID` bigint(20) NOT NULL, `CONTAINER` varchar(250) DEFAULT NULL, `MSGID_PROD` varchar(250) DEFAULT NULL, `MSGID_SEQ` bigint(20) DEFAULT NULL, `EXPIRATION` bigint(20) DEFAULT NULL, `MSG` longblob, `PRIORITY` bigint(20) DEFAULT NULL, PRIMARY KEY (`ID`), KEY `ACTIVEMQ_MSGS_MIDX` (`MSGID_PROD`,`MSGID_SEQ`), KEY `ACTIVEMQ_MSGS_CIDX` (`CONTAINER`), KEY `ACTIVEMQ_MSGS_EIDX` (`EXPIRATION`), KEY `ACTIVEMQ_MSGS_PIDX` (`PRIORITY`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; # # Dumping data for table activemq_msgs # LOCK TABLES `activemq_msgs` WRITE; /*!40000 ALTER TABLE `activemq_msgs` DISABLE KEYS */; INSERT INTO `activemq_msgs` VALUES (1,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',1,0,X'0000010C1C0000000501017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000001000000000000000400000000000000010000000000000000040000000130450E28660001000000120000000E74657374206D657373616765203100000000000000000000000000000000000000000000000130450E28950000000000000000',4); INSERT INTO `activemq_msgs` VALUES (2,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',2,0,X'0000010C1C0000000601017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E5155