Module: Vx::Common::AMQP

Extended by:
AMQP
Included in:
AMQP
Defined in:
lib/vx/common/amqp.rb,
lib/vx/common/amqp/cli.rb,
lib/vx/common/amqp/config.rb,
lib/vx/common/amqp/session.rb,
lib/vx/common/amqp/testing.rb,
lib/vx/common/amqp/version.rb,
lib/vx/common/amqp/consumer.rb,
lib/vx/common/amqp/formatter.rb,
lib/vx/common/amqp/consumer/ack.rb,
lib/vx/common/amqp/consumer/publish.rb,
lib/vx/common/amqp/mixins/instrument.rb,
lib/vx/common/amqp/consumer/subscribe.rb,
lib/vx/common/amqp/supervisor/threaded.rb,
lib/vx/common/amqp/consumer/configuration.rb

Defined Under Namespace

Modules: Consumer, Instrument, Supervisor, Testing Classes: CLI, Config, Formatter, Session

Constant Summary collapse

VERSION =
"0.3.7"
@@config =
Common::AMQP::Config.new
@@session =
Common::AMQP::Session.new

Instance Method Summary collapse

Instance Method Details

#closeObject



44
45
46
# File 'lib/vx/common/amqp.rb', line 44

def close
  session.close
end

#configObject



28
29
30
# File 'lib/vx/common/amqp.rb', line 28

def config
  @@config
end

#configure {|config| ... } ⇒ Object

Yields:



24
25
26
# File 'lib/vx/common/amqp.rb', line 24

def configure
  yield config
end

#instrument(name, payload, &block) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vx/common/amqp.rb', line 57

def instrument(name, payload, &block)
  if config.debug?
    STDOUT.puts "name: #{name} payload: #{payload.inspect}"
  end

  if config && config.instrumenter
    config.instrumenter.instrument(name, payload, &block)
  else
    yield if block_given?
  end
end

#openObject



36
37
38
# File 'lib/vx/common/amqp.rb', line 36

def open
  session.open
end

#open?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/vx/common/amqp.rb', line 40

def open?
  session.open?
end

#sessionObject



32
33
34
# File 'lib/vx/common/amqp.rb', line 32

def session
  @@session
end

#shutdownObject



48
49
50
51
# File 'lib/vx/common/amqp.rb', line 48

def shutdown
  Common::AMQP::Session.shutdown
  Vx::Common::AMQP::Supervisor::Threaded.shutdown
end

#shutdown?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/vx/common/amqp.rb', line 53

def shutdown?
  Common::AMQP::Session.shutdown?
end