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

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

Constant Summary

Constants inherited from Legion::Transport::Message

Legion::Transport::Message::ENVELOPE_KEYS

Constants included from Common

Common::NAMESPACE_BOUNDARIES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Legion::Transport::Message

#app_id, #channel, #content_encoding, #content_type, #correlation_id, #encode_message, #encrypt?, #encrypt_message, #exchange_name, #expiration, #headers, #initialize, max_payload_bytes, #message_id, #persistent, #priority, #publish, #reply_to, #timestamp, #user_id, #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.



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

def options
  @options
end

Instance Method Details

#exchangeObject



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

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

#functionObject



26
27
28
# File 'lib/legion/transport/messages/dynamic.rb', line 26

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

#messageObject



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

def message
  { args:     @options[:args] || @options,
    function: function.values[:name] }
end

#routing_keyObject



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

def routing_key
  key = "#{function.runner.extension.values[:name]}.#{function.runner.values[:name]}.#{function.values[:name]}"
  log.debug "Dynamic routing_key=#{key} function_id=#{@options[:function_id]}"
  key
end

#typeObject



7
8
9
# File 'lib/legion/transport/messages/dynamic.rb', line 7

def type
  'task'
end