public OrderDto create(final OrderDto order) throws OrderException{
OrderDto createOrderDto = executeInShardingTrans((status)->{
OrderDto insertOrderDto = convert(orderService.insert(order));
return insertOrderDto;
});
//发MQ
orderMqProducer.publish(OrderMqType.CREATED,null,insertOrderDTO);
//写缓存
orderCache.put(createOrderDto);
return createdOrderDTO;
}
JAVA的MQ双写示例
最新推荐文章于 2023-12-15 20:55:21 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)