Last active
October 29, 2021 12:10
-
-
Save bsingr/a330af6dc0eae322117c4f35dce472e4 to your computer and use it in GitHub Desktop.
rabbitmq amqp delete queues
This file contains hidden or 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
const filter = 'node.1.response.queue' // e.g. when someone used foo-foo-mq with replyQueue:true defaults | |
const baseUrl = 'http://rabbitmq:15762' | |
let pageIdx = 1 | |
let shouldFetchAnotherPage = true | |
while (shouldFetchAnotherPage) { | |
console.log('Fetching queues page ' + pageIdx) | |
const queues = await (await fetch(`${baseUrl}/api/queues?page=1&page_size=500&name=${filter}&use_regex=false&pagination=true`)).json() | |
shouldFetchAnotherPage = queues.page_count > 1 | |
for (const queue of queues.items) { | |
if (queue.name.match(new RegExp(filter))) { | |
await fetch(`${baseUrl}/api/queues/%2F/${queue.name}`, { | |
method: 'delete' | |
}) | |
console.log('Deleted ' + queue.name) | |
} | |
} | |
pageIdx++ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment