侧边栏壁纸
  • 累计撰写 175 篇文章
  • 累计创建 87 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

批量给rabbitmq灌数据

Z先森
2022-02-23 / 0 评论 / 0 点赞 / 11 阅读 / 747 字 / 正在检测是否收录...

分两个文件 主脚本mq.sh key文件key.txt,一行一个

#!/bin/bash
mq_host="192.168.0.100:15672"
mq_exchange="TestExchange"
mq_queue="TestQueue"
mq_vhost="%2Fadmin"  #/请写%2F
user="admin"
passwd="admin"

cat key.txt|while read payload
do
#properties根据程序需求实际情况填写
curl -XPOST "http://${mq_host}/api/exchanges/${mq_vhost}/${mq_exchange}/publish" -d '{"vhost":"/admin","name":"amq.default","properties":{"delivery_mode":1,"headers":{},"type":"System.String, System.Private.CoreLib"},"routing_key":"'"${mq_queue}"'","delivery_mode":"1","payload":"'"${payload}"'","headers":{},"props":{"type":"System.String, System.Private.CoreLib"},"payload_encoding":"string"}' -u $user:$passwd -H "content-type:application/json"
done

0

评论区