Last active
November 10, 2020 14:05
-
-
Save johanrhodin/8a259e2a3b750159fcea9fea32fb41b2 to your computer and use it in GitHub Desktop.
Fill up pg2table in RabbitMQ
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
#!/usr/bin/env ruby | |
require 'bunny' | |
require 'dotenv/load' | |
connection = Bunny.new ENV['CLOUDAMQP_URL3'] | |
connection.start | |
channel = connection.create_channel # Declare a channel | |
for i in 1..1 | |
puts "Creating queue #{i}" | |
queue = channel.queue("", :exclusive=> true, :arguments => { "x-message-ttl" => 2000 , "x-expires"=>10000}) | |
# publish 1 messsage to the queue | |
x = channel.default_exchange | |
x.publish("Message #{i}", :routing_key => queue.name) | |
end | |
sleep(15) | |
connection.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment