Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "bunny"
- class TestRabbitMQConnection
- attr_reader :host,
- :port,
- :username,
- :password
- def initialize(host: , port:, username:, password:)
- @host = host
- @port = port
- @username = username
- @password = password
- end
- def perform
- connection.start
- puts connection.inspect
- puts channel.inspect
- channel.close
- connection.stop
- puts "OK"
- end
- def connection
- @connection ||= Bunny.new(
- host: host,
- port: port,
- username: username,
- password: password
- )
- end
- def channel
- @channel ||= connection.create_channel
- end
- end
- TestRabbitMQConnection.new(
- host: "127.0.0.1",
- port: 51853,
- username: "a9s-brk-usr-wjzxgxwjxgrzzlusyjkvnkmvbuhwgcyhdc",
- password: "VztISCgo50yPXUQljPbxqqnfd1N0af0hQg"
- ).perform
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement