Class: Cloud::Deploy::Monitor
- Inherits:
-
Object
- Object
- Cloud::Deploy::Monitor
- Defined in:
- lib/cloud/deploy/monitor.rb
Instance Attribute Summary collapse
-
#artifact ⇒ Object
readonly
Returns the value of attribute artifact.
-
#config ⇒ Object
Returns the value of attribute config.
-
#md5sum ⇒ Object
readonly
Returns the value of attribute md5sum.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #deploy! ⇒ Object
-
#initialize(config, name) ⇒ Monitor
constructor
A new instance of Monitor.
Constructor Details
#initialize(config, name) ⇒ Monitor
Returns a new instance of Monitor.
29 30 31 32 33 |
# File 'lib/cloud/deploy/monitor.rb', line 29 def initialize(config, name) @config = config @name = name @exchange = @config['default']['exchange'] end |
Instance Attribute Details
#artifact ⇒ Object (readonly)
Returns the value of attribute artifact.
26 27 28 |
# File 'lib/cloud/deploy/monitor.rb', line 26 def artifact @artifact end |
#config ⇒ Object
Returns the value of attribute config.
27 28 29 |
# File 'lib/cloud/deploy/monitor.rb', line 27 def config @config end |
#md5sum ⇒ Object (readonly)
Returns the value of attribute md5sum.
26 27 28 |
# File 'lib/cloud/deploy/monitor.rb', line 26 def md5sum @md5sum end |
#name ⇒ Object
Returns the value of attribute name.
27 28 29 |
# File 'lib/cloud/deploy/monitor.rb', line 27 def name @name end |
Instance Method Details
#deploy! ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cloud/deploy/monitor.rb', line 35 def deploy! defaults = @config['default'] # Connect to RabbitMQ... host = defaults['host'] port = defaults['port'] user = defaults['user'] pass = defaults['password'] vhost = defaults['virtual_host'] exchange = defaults['exchange'] $log.info(@name) { "Connecting to MQ h: #{host}, p: #{port}, u: #{user}, pw: #{pass}, v: #{vhost}, x: #{exchange}" } AMQP.start(:host => host, :port => port, :user => user, :pass => pass, :vhost => vhost) do MQ.queue(@name, :durable => true, :auto_delete => false).bind(@exchange, :type => "topic", :durable => true).subscribe(:ack => true) do |headers, body| @md5sum = headers.properties[:correlation_id] $log.debug('monitor') { "MD5 sum: #{@md5sum}" } @artifact = body end end end |