xxl-mq
xxl-mq copied to clipboard
consumer group 和provider group设计在一起了,是有问题的
- provider端发送消息时,需要知道consumer的group,否则消息查询不到,group设计耦合了
- 测试用例中可以用,是因为都是DEFAULT
List<XxlMqMessage> list = xxlMqMessageDao.pullNewMessage(XxlMqMessageStatus.NEW.name(), topic, group, consumerRank, consumerTotal, pagesize);
对应sql
SELECT <include refid="Base_Column_List" />
FROM xxl_mq_message AS t
WHERE t.topic = #{topic}
AND t.group = #{group}
AND t.status = #{newStatus}
AND t.effectTime <![CDATA[ < ]]> NOW()
<if test="consumerTotal > 1">
AND (
(
t.shardingId <![CDATA[ = ]]> 0
AND
MOD(t.id, #{consumerTotal}) = #{consumerRank}
)
OR
(
t.shardingId <![CDATA[ > ]]> 0
AND
MOD(t.shardingId, #{consumerTotal}) = #{consumerRank}
)
)
</if>
ORDER BY t.id ASC
LIMIT #{pagesize}