Class: Legion::Transport::Messages::SubTask

Inherits:
Legion::Transport::Message show all
Defined in:
lib/legion/transport/messages/subtask.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, #routing_key, #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



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

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

#messageObject



11
12
13
14
15
16
17
# File 'lib/legion/transport/messages/subtask.rb', line 11

def message
  {
    transformation: @options[:transformation] || '{}',
    conditions: @options[:conditions] || '{}',
    results: @options[:results] || '{}'
  }
end

#validateObject

Raises:

  • (TypeError)


19
20
21
22
23
# File 'lib/legion/transport/messages/subtask.rb', line 19

def validate
  raise TypeError unless @options[:function].is_a? String

  @valid = true
end