定时消息队列
介绍 TMQ:定时消息队列
push(MessageInterface msg)
pull(Date t)
poll(String msgId)
size(Date t)
consumed(MessageInterface msg)
MySQL连接
jdbc:mysql://127.0.0.1:3306/mydemo
Redis连接
localhost:6379
CREATE TABLE tmq_queue (
id INT NOT NULL AUTO_INCREMENT,
queue_name VARCHAR(64) NOT NULL COMMENT '队列名称',
msg_id VARCHAR(24) NOT NULL COMMENT '消息ID',
body VARCHAR(1024) NOT NULL COMMENT '消息体',
schedule DATETIME NOT NULL COMMENT '投递时间',
status TINYINT NOT NULL COMMENT '消息状态',
receive_at DATETIME NOT NULL COMMENT '接收时间',
consume_at DATETIME COMMENT '消费时间',
PRIMARY KEY (id),
UNIQUE KEY idx_msg_id (msg_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
见 com.limengxiang.tmq.TimingMessageQueueTest
MySQL
> SELECT * FROM tmq_queue;
Redis
> keys *:slice:*
> lrange {slice key} 0 -1
参考 xid