I'm using this tool: rabbitmq-dump-queue.
The steps:
wget https://github.com/dubek/rabbitmq-dump-queue/releases/download/v0.3/rabbitmq-dump-queue-v0.3-linux-amd64.tgz
tar xvf rabbitmq-dump-queue-v0.3-linux-amd64.tgz
cd rabbitmq-dump-queue-v0.3-linux-amd64/
ls -la
mkdir out
./rabbitmq-dump-queue -uri="amqp://rmq_admin:password@localhost:5672/" -queue=queue -max-messages=50 -output-dir=./out/