class EventMachine::Synchrony::AMQP::Exchange

Public Class Methods

new(channel, type, name, opts = {}, &block) click to toggle source
Calls superclass method
# File lib/em-synchrony/amqp.rb, line 117
def initialize(channel, type, name, opts = {}, &block)
  f = Fiber.current

  # AMQP Exchange constructor handles certain special exchanges differently.
  # The callback passed in isn't called when the response comes back
  # but is called immediately on the original calling fiber. That means that
  # when the sync_cb callback yields the fiber when called, it will hang and never
  # be resumed.  So handle these exchanges without yielding
  if name == "amq.#{type}" or name.empty? or opts[:no_declare]
    exchange = nil
    super(channel, type, name, opts) { |ex| exchange = ex }
  else
    super(channel, type, name, opts, &EM::Synchrony::AMQP.sync_cb(f))
    exchange, declare_ok = Fiber.yield
    raise Error.new(declare_ok.to_s) unless declare_ok.is_a?(::AMQ::Protocol::Exchange::DeclareOk)
  end

  exchange
end

Public Instance Methods

adelete(opts = {})
Alias for: delete
apublish(payload, options = {})
Alias for: publish
delete(opts = {}) click to toggle source
# File lib/em-synchrony/amqp.rb, line 143
def delete(opts = {})
  EM::Synchrony::AMQP.sync { |f| adelete(opts, &EM::Synchrony::AMQP.sync_cb(f)) }
end
Also aliased as: adelete
publish(payload, options = {}) click to toggle source
# File lib/em-synchrony/amqp.rb, line 138
def publish payload, options = {}
  apublish(payload, options)
end
Also aliased as: apublish