Last active
October 13, 2021 21:05
-
-
Save johanrhodin/2697ba044fee518a66f5a19ee164ae13 to your computer and use it in GitHub Desktop.
A small examples showing a working queue federation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Minimum Viable Federation | |
#Upstream servers are the servers towards messages are originally published | |
#Downstream servers are where the messages get forwarded to | |
# 1. Two clusters | |
DOWNSTREAM_URL="amqps://tynqsojc:PASSWD@test-server-1.rmq.cloudamqp.com/tynqsojc" | |
UPSTREAM_URL="amqps://prksmzye:PASSWD@test-server-2.rmq.cloudamqp.com/prksmzye" | |
VHOST=tynqsojc | |
HTTPS_DOWNSTREAM="https://tynqsojc:PASSWD@test-server-1.rmq.cloudamqp.com" | |
# 2. Queue | |
# Create queue on upstream and load it with 100000 messages | |
rabbitmq-perf-test-2.9.1/bin/runjava com.rabbitmq.perf.PerfTest -h $UPSTREAM_URL -ad false -f persistent -x 1 -y 0 -u myfedqueue -pmessages 100000 | |
# 3. Create policy on downstream | |
curl -i -v -X PUT -H 'Content-Type: application/json' $HTTPS_DOWNSTREAM/api/policies/$VHOST/fedit/ -d '{"pattern":"myfedqueue", "definition": {"federation-upstream-set":"all"}, "priority":0, "apply-to": "queues"}' | |
# 4. Create federation-upstream on downstream | |
curl -i -XPUT -H "content-type:application/json" -d'{"value":{"uri":"'$UPSTREAM_URL'"}}' $HTTPS_DOWNSTREAM/api/parameters/federation-upstream/$VHOST/upstream | |
# 5. Create consumers on downstream (without consumers, no links!): | |
rabbitmq-perf-test-2.9.1/bin/runjava com.rabbitmq.perf.PerfTest -h $DOWNSTREAM_URL -ad false -f persistent -x 0 -y 1 -u myfedqueue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment