Class: Legion::Transport::Messages::Dynamic

Inherits:
Legion::Transport::Message show all
Defined in:
lib/legion/transport/messages/dynamic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Legion::Transport::Message

#content_encoding, #content_type, #encode_message, #encrypt?, #encrypt_message, #exchange_name, #expiration, #headers, #initialize, #priority, #publish, #timestamp, #validate

Methods included from Common

#channel, #channel_open?, #close, #close!, #deep_merge, #generate_consumer_tag, #open_channel, #options_builder

Constructor Details

This class inherits a constructor from Legion::Transport::Message

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/legion/transport/messages/dynamic.rb', line 3

def options
  @options
end

Instance Method Details

#exchangeObject



17
18
19
# File 'lib/legion/transport/messages/dynamic.rb', line 17

def exchange
  Legion::Transport::Exchange.new(function.runner.extension.values[:exchange])
end

#functionObject



21
22
23
# File 'lib/legion/transport/messages/dynamic.rb', line 21

def function
  @function ||= Legion::Data::Model::Function[@options[:function_id]]
end

#messageObject



9
10
11
# File 'lib/legion/transport/messages/dynamic.rb', line 9

def message
  { args: @options[:args] || @options }
end

#routing_keyObject



13
14
15
# File 'lib/legion/transport/messages/dynamic.rb', line 13

def routing_key
  "#{function.runner.extension.values[:name]}.#{function.runner.values[:name]}.#{function.values[:name]}"
end

#typeObject



5
6
7
# File 'lib/legion/transport/messages/dynamic.rb', line 5

def type
  'task'
end