Class: Legion::Transport::Messages::TaskLog

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

Constant Summary

Constants inherited from Legion::Transport::Message

Legion::Transport::Message::ENVELOPE_KEYS

Constants included from Common

Common::NAMESPACE_BOUNDARIES

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, #type, #user_id

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 Method Details

#exchangeObject



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

def exchange
  Legion::Transport::Exchanges::Task
end

#generate_task?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/legion/transport/messages/task_log.rb', line 23

def generate_task?
  false
end

#messageObject



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

def message
  @options[:function] = 'add_log'
  @options[:runner_class] = 'Legion::Extensions::Tasker::Runners::Log'
  @options
end

#routing_keyObject



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

def routing_key
  "task.logs.create.#{@options[:task_id]}"
end

#validateObject



27
28
29
30
31
32
# File 'lib/legion/transport/messages/task_log.rb', line 27

def validate
  @options[:task_id] = @options[:task_id].to_i if @options[:task_id].is_a? String
  raise "task_id must be an integer but is #{@options[:task_id].class}(#{@options[:task_id]})" unless @options[:task_id].is_a? Integer

  @valid = true
end