CREATE TABLE `topic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL COMMENT '主题名',
`message_retention` int(11) NOT NULL COMMENT '消息保留时间ms',
`message_max_bytes` int(11) NOT NULL COMMENT '消息最大字节数',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='主题表';
CREATE TABLE `consumer_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`topic_id` int(11) NOT NULL COMMENT '主题id',
`name` varchar(32) NOT NULL COMMENT '分组名',
`last_message_id` int(11) NOT NULL COMMENT '最后消费的消息ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消费者分组表';
CREATE TABLE `consumer_group_message` (
`group_id` int(11) NOT NULL COMMENT '分组id',
`message_id` int(11) NOT NULL COMMENT '消息id',
`ack_at` datetime DEFAULT NULL COMMENT '消息确认时间',
PRIMARY KEY (`group_id`,`message_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消费者分组消息表';
CREATE TABLE `message_topicName` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`message` text COMMENT '消息内容',
`created_at` datetime DEFAULT NULL COMMENT '生产时间',
PRIMARY KEY (`id`),
KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息表';
评论