Class: Legion::Transport::Queues::Agent

Inherits:
Legion::Transport::Queue show all
Defined in:
lib/legion/transport/queues/agent.rb

Constant Summary

Constants included from Common

Common::NAMESPACE_BOUNDARIES

Instance Method Summary collapse

Methods inherited from Legion::Transport::Queue

#acknowledge, #default_options, #delete, #dlx_enabled, #dlx_exchange_name, #ensure_dlx, #nack_or_dlq, #own_queue?, #passive?, #recreate_queue, #reject

Methods included from Common

#channel, #channel_open?, #close, #close!, #deep_merge, #generate_consumer_tag, #open_channel, #options_builder

Constructor Details

#initialize(agent_id: nil) ⇒ Agent

Returns a new instance of Agent.



7
8
9
10
# File 'lib/legion/transport/queues/agent.rb', line 7

def initialize(agent_id: nil, **)
  @agent_id = agent_id
  super(**)
end

Instance Method Details

#queue_nameObject



12
13
14
15
16
17
18
# File 'lib/legion/transport/queues/agent.rb', line 12

def queue_name
  if @agent_id
    "agent.#{@agent_id}"
  else
    "agent.#{Legion::Settings['client']['name']}"
  end
end

#queue_optionsObject



20
21
22
# File 'lib/legion/transport/queues/agent.rb', line 20

def queue_options
  { durable: false, auto_delete: true, arguments: { 'x-dead-letter-exchange': 'agent.dlx', 'x-queue-type': 'classic' } }
end