Initial commit

This commit is contained in:
Yaser
2026-08-13 19:50:53 +03:30
commit 38084458fe
879 changed files with 95198 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
class RabbitMQHTTP
class << self
def default_client
new(default_options)
end
def default_options
{ scheme: :http,
host: ENV.fetch('RABBITMQ_HOST', 'localhost'),
port: 15672,
path: '/api',
user: ENV.fetch('RABBITMQ_USER', 'guest'),
password: ENV.fetch('RABBITMQ_PASSWORD', 'guest') }
end
end
def initialize(options)
url = ::URI::HTTP.build(options.slice(:scheme, :host, :port, :path))
@connection = Faraday.new(url) do |conn|
conn.basic_auth options.fetch(:user), options.fetch(:password)
conn.adapter Faraday.default_adapter
end
end
def list_queues
response = @connection.get('queues')
JSON.parse(response.body).map(&:symbolize_keys)
end
end