Skip to content

Instantly share code, notes, and snippets.

@johanrhodin
Created April 25, 2022 20:38
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 johanrhodin/828ff6e3f7958b448c93483f73ed072a to your computer and use it in GitHub Desktop.
Save johanrhodin/828ff6e3f7958b448c93483f73ed072a to your computer and use it in GitHub Desktop.
Connection is left over when disk free alarm is in place
require 'amqp-client'
require 'dotenv/load'
NRM = 1
AMQPURL = ENV.fetch('CLOUDAMQP_URL')
conn = AMQP::Client.new(AMQPURL, connection_name:'leftover-connection').connect
ch = conn.channel
ch.confirm_select
puts "Creating queue"
q = ch.queue_declare("myqueue")
# Create NRM number of messages
NRM.times do |i|
puts "Sending message #{i}"
ch.basic_publish_confirm("Aloha World!", "", q.queue_name, persistent: true)
end
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment