|
@@ -177,19 +177,19 @@ public class RocketMQProducer {
|
|
* 顺序消费 (计算场景使用)
|
|
* 顺序消费 (计算场景使用)
|
|
* @param topic 主题名
|
|
* @param topic 主题名
|
|
* @param body 消息体
|
|
* @param body 消息体
|
|
|
|
+ * hashKey 1 为计算推送消息
|
|
*/
|
|
*/
|
|
public void sendInOrder(String topic, Object body){
|
|
public void sendInOrder(String topic, Object body){
|
|
- this.sendInOrder(topic,"modeling",body);
|
|
|
|
|
|
+ this.sendInOrder(topic,"1",body);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 顺序消费 计算场景使用)
|
|
* 顺序消费 计算场景使用)
|
|
* @param topic 主题名
|
|
* @param topic 主题名
|
|
- * @param hashKey: 为了保证报到同一个队列中,将消息发送到orderTopic主题上
|
|
|
|
|
|
+ * @param hashKey: 队列key,保证报到同一个队列中 ( number )
|
|
* @param body 消息体
|
|
* @param body 消息体
|
|
*/
|
|
*/
|
|
public void sendInOrder(String topic, String hashKey, Object body){
|
|
public void sendInOrder(String topic, String hashKey, Object body){
|
|
log.info("MQ推送消息---topic:{},hashKey:{},msg:{}",topic,hashKey, JSONObject.toJSONString(body));
|
|
log.info("MQ推送消息---topic:{},hashKey:{},msg:{}",topic,hashKey, JSONObject.toJSONString(body));
|
|
- rocketMQTemplate.setMessageQueueSelector((list, message, o) -> list.get(Integer.parseInt(o.toString())));
|
|
|
|
rocketMQTemplate.syncSendOrderly(topic,body,hashKey);
|
|
rocketMQTemplate.syncSendOrderly(topic,body,hashKey);
|
|
log.info("MQ推送成功---topic:{},hashKey:{},msg:{}",topic,hashKey, JSONObject.toJSONString(body));
|
|
log.info("MQ推送成功---topic:{},hashKey:{},msg:{}",topic,hashKey, JSONObject.toJSONString(body));
|
|
}
|
|
}
|