Class: ActionSubscriber::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/action_subscriber/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Route

Returns a new instance of Route.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/action_subscriber/route.rb', line 13

def initialize(attributes)
  @acknowledgements = attributes.fetch(:acknowledgements)
  @action = attributes.fetch(:action)
  @durable = attributes.fetch(:durable)
  @exchange = attributes.fetch(:exchange).to_s
  @prefetch = attributes.fetch(:prefetch) { ::ActionSubscriber.config.prefetch }
  @queue = attributes.fetch(:queue)
  @routing_key = attributes.fetch(:routing_key)
  @subscriber = attributes.fetch(:subscriber)
  @threadpool_name = attributes.fetch(:threadpool_name)
  if attributes.has_key?(:concurrency)
    concurrency = attributes[:concurrency]
    ::ActionSubscriber.print_deprecation_warning("setting prefetch for #{@queue} to #{concurrency}")
    @prefetch = concurrency
  end
end

Instance Attribute Details

#acknowledgementsObject (readonly)

Returns the value of attribute acknowledgements.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def acknowledgements
  @acknowledgements
end

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def action
  @action
end

#durableObject (readonly)

Returns the value of attribute durable.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def durable
  @durable
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def exchange
  @exchange
end

#prefetchObject (readonly)

Returns the value of attribute prefetch.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def prefetch
  @prefetch
end

#queueObject (readonly)

Returns the value of attribute queue.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def queue
  @queue
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def routing_key
  @routing_key
end

#subscriberObject (readonly)

Returns the value of attribute subscriber.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def subscriber
  @subscriber
end

#threadpool_nameObject (readonly)

Returns the value of attribute threadpool_name.



3
4
5
# File 'lib/action_subscriber/route.rb', line 3

def threadpool_name
  @threadpool_name
end

Instance Method Details

#acknowledgements?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/action_subscriber/route.rb', line 30

def acknowledgements?
  @acknowledgements
end

#queue_subscription_optionsObject



34
35
36
# File 'lib/action_subscriber/route.rb', line 34

def queue_subscription_options
  { :manual_ack => acknowledgements? }
end