其他分享
首页 > 其他分享> > 11 rabbitMQ 异步请求

11 rabbitMQ 异步请求

作者:互联网

### 1 MiaoshaController implements InitializingBean```
/**
* 系统初始化时获取商品库存
* @throws Exception
*/
@Override
public void afterPropertiesSet() throws Exception {
List<GoodsVo> goodsList = goodsService.listGoodsVo();
if(goodsList == null){
return;
}
for(GoodsVo goodsVo : goodsList){
redisService.set(GoodsKey.getMiaoshaGoodsStock, ""+goodsVo.getId(), goodsVo.getStockCount());
}
}
```### 2报错解决:添加bean定义。。
@Bean
public Queue miaosha_queue() {
return new Queue(MIAOSHA_QUEUE, true);
}


- 压测 ./bin/jmeter.sh -n -t redis_mq/miaosha_redis_mq.jmx -l redis_mq/miaosha_redis_mq.jtl 

### 3 nginx 反向代理


sudo sh /usr/tomcat8/bin/shutdown.sh
# 查看进程netstat -aptn | grep 8080
# kill -9 pid
sudo java -jar ~/Documents/tar/apache-jmeter-5.4.1/redis_mq/miaosha.jar
rm -f redis_mq/miaosha_redis_mq.jtl sudo vi ./redis_mq/miaosha_redis_mq.jmx./bin/jmeter.sh -n -t  ./redis_mq/miaosha_redis_mq.jmx -l ./redis_mq/miaosha_redis_mq.jtl   

标签:11,异步,jmx,goodsVo,redis,rabbitMQ,miaosha,sh,mq
来源: https://www.cnblogs.com/weidalin/p/14995034.html