Files

Moqueue::ObjectMethods

Public Instance Methods

mock_exchange(opts={}) click to toggle source

Takes a hash to specify the exchange type and its name.

topic = mock_exchange(:topic => 'topic exchange')
# File lib/moqueue/object_methods.rb, line 21
def mock_exchange(opts={})
  MockExchange.new(opts)
end
mock_queue(name=nil) click to toggle source

Takes a string name as a parameter. Each queue name may only be used once. Multiple calls to mock_queue with the same name will return the same object.

# File lib/moqueue/object_methods.rb, line 14
def mock_queue(name=nil)
  MockQueue.new(name || "anonymous-#{rand(2**32).to_s(16)}")
end
mock_queue_and_exchange(name=nil) click to toggle source
# File lib/moqueue/object_methods.rb, line 4
def mock_queue_and_exchange(name=nil)
  queue = mock_queue(name)
  exchange = mock_exchange
  exchange.attached_queues << queue
  [queue, exchange]
end
overload_amqp() click to toggle source

Overloads the class-level method calls typically used by AMQP code such as MQ.direct, MQ.queue, MQ.topic, etc.

# File lib/moqueue/object_methods.rb, line 27
def overload_amqp
  require MOQUEUE_ROOT + "moqueue/overloads"
end
reset_broker() click to toggle source

Deletes all exchanges and queues from the mock broker. As a consequence of removing queues, all bindings and subscriptions are also deleted.

# File lib/moqueue/object_methods.rb, line 33
def reset_broker
  MockBroker.instance.reset!
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.