class EventQ::RabbitMq::StatusChecker
Public Class Methods
new(client:, queue_manager:)
click to toggle source
# File lib/eventq_rabbitmq/rabbitmq_status_checker.rb, line 5 def initialize(client:, queue_manager:) if client == nil raise 'client must be specified.'.freeze end @client = client if queue_manager == nil raise 'queue_manager must be specified.'.freeze end @queue_manager = queue_manager @event_raised_exchange = EventRaisedExchange.new end
Public Instance Methods
event_type?(event_type)
click to toggle source
# File lib/eventq_rabbitmq/rabbitmq_status_checker.rb, line 42 def event_type?(event_type) outcome = true begin connection = @client.get_connection channel = connection.create_channel @queue_manager.get_exchange(channel, @event_raised_exchange) rescue outcome = false ensure channel.close if channel connection.close if connection end outcome end
queue?(queue)
click to toggle source
# File lib/eventq_rabbitmq/rabbitmq_status_checker.rb, line 23 def queue?(queue) outcome = true begin connection = @client.get_connection channel = connection.create_channel _queue_name = EventQ.create_queue_name(queue.name) channel.queue(_queue_name, :durable => true) rescue outcome = false ensure channel.close if channel connection.close if connection end outcome end