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

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

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

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



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

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

#generate_task?Boolean

Returns:

  • (Boolean)


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

def generate_task?
  false
end

#messageObject



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

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

#routing_keyObject



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

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

#validateObject



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

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

  @valid = true
end