Class: Legion::LLM::Transport::Messages::FleetRequest

Inherits:
Legion::LLM::Transport::Message show all
Includes:
Legion::Logging::Helper
Defined in:
lib/legion/llm/transport/messages/fleet_request.rb

Constant Summary collapse

PRIORITY_MAP =
{ critical: 9, high: 7, normal: 5, low: 2 }.freeze

Constants inherited from Legion::LLM::Transport::Message

Legion::LLM::Transport::Message::LLM_ENVELOPE_KEYS

Instance Method Summary collapse

Methods inherited from Legion::LLM::Transport::Message

#app_id, #correlation_id, #headers, #message_context, #message_id, #tracing_headers

Instance Method Details

#exchangeObject



16
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 16

def exchange    = Legion::LLM::Transport::Exchanges::Fleet

#expirationObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 21

def expiration
  ttl = @options[:ttl]
  return super if ttl.nil? || ttl.to_s.strip.empty?

  ttl_seconds = Float(ttl)
  return super unless ttl_seconds.positive?

  (ttl_seconds * 1000).ceil.to_s
rescue ArgumentError, TypeError => e
  handle_exception(e, level: :warn, handled: true, operation: 'llm.fleet_request.expiration', ttl: ttl)
  super
end

#messageObject



34
35
36
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 34

def message
  super.merge(reply_to: reply_to, correlation_id: correlation_id).compact
end

#priorityObject



19
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 19

def priority    = map_priority(@options[:priority])

#publish(options = nil) ⇒ Object



38
39
40
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 38

def publish(options = nil)
  super(default_publish_options.merge(options || {}))
end

#reply_toObject



18
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 18

def reply_to    = @options[:reply_to]

#routing_keyObject



17
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 17

def routing_key = @options[:routing_key]

#typeObject



15
# File 'lib/legion/llm/transport/messages/fleet_request.rb', line 15

def type        = 'llm.fleet.request'