Skip to content

Instantly share code, notes, and snippets.

@DannyDainton
Last active June 29, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DannyDainton/2bae06e3ca898440cdc0452a727ee7bf to your computer and use it in GitHub Desktop.
Save DannyDainton/2bae06e3ca898440cdc0452a727ee7bf to your computer and use it in GitHub Desktop.
JQuery code to Purge Specific Queues on RabbitMQ
var purgeQueue = (name, callback) => {
$.ajax({
url: 'api/queues/<VHOST>/' + name + '/contents/',
type: 'DELETE',
success: callback
})
}
$.ajax({
url: '/api/queues/',
success: (data) => {
for (queue in data) {
queueName = data[queue].name
if (queueName.startsWith("<NAME OF QUEUE>")){
purgeQueue(queueName)
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment