Class: Daemon::MasterProcess::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/onapp/engine/master_process/message.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Message) initialize(raw)

Returns a new instance of Message



6
7
8
9
10
11
# File 'lib/onapp/engine/master_process/message.rb', line 6

def initialize(raw)
  @raw = raw
  @data = parse(@raw) || {}
  @destination = @data.delete('destination')
  @command = @data.fetch('payload', {})['cmd']
end

Instance Attribute Details

- (Object) command (readonly)

Returns the value of attribute command



4
5
6
# File 'lib/onapp/engine/master_process/message.rb', line 4

def command
  @command
end

- (Object) data (readonly)

Returns the value of attribute data



4
5
6
# File 'lib/onapp/engine/master_process/message.rb', line 4

def data
  @data
end

- (Object) destination (readonly)

Returns the value of attribute destination



4
5
6
# File 'lib/onapp/engine/master_process/message.rb', line 4

def destination
  @destination
end

- (Object) raw (readonly) Also known as: to_s

Returns the value of attribute raw



4
5
6
# File 'lib/onapp/engine/master_process/message.rb', line 4

def raw
  @raw
end

Instance Method Details

- (Boolean) current_node?

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/onapp/engine/master_process/message.rb', line 13

def current_node?
  [::Availability::ALL_NODES, Availability::ClusteringService.current_node_ip]
    .include?(destination)
end