Module: Asynk::Consumer::ClassMethods
- Defined in:
- lib/asynk/consumer.rb
Instance Attribute Summary collapse
-
#queue_options ⇒ Object
readonly
Returns the value of attribute queue_options.
-
#routing_keys ⇒ Object
readonly
Returns the value of attribute routing_keys.
-
#subscribe_arguments ⇒ Object
readonly
Returns the value of attribute subscribe_arguments.
Instance Method Summary collapse
- #action_name_from_routing_key(routing_key) ⇒ Object
- #concurrency ⇒ Object
- #queue_name ⇒ Object
- #route_ending_as_action? ⇒ Boolean
- #set_concurrency(size) ⇒ Object
- #set_consume(*routing_keys) ⇒ Object
- #set_queue_name(options = {}) ⇒ Object
- #set_queue_options(options = {}) ⇒ Object
- #set_route_ending_as_action(value) ⇒ Object
- #set_subscribe_arguments(arguments = {}) ⇒ Object
Instance Attribute Details
#queue_options ⇒ Object (readonly)
Returns the value of attribute queue_options.
48 49 50 |
# File 'lib/asynk/consumer.rb', line 48 def @queue_options end |
#routing_keys ⇒ Object (readonly)
Returns the value of attribute routing_keys.
48 49 50 |
# File 'lib/asynk/consumer.rb', line 48 def routing_keys @routing_keys end |
#subscribe_arguments ⇒ Object (readonly)
Returns the value of attribute subscribe_arguments.
48 49 50 |
# File 'lib/asynk/consumer.rb', line 48 def subscribe_arguments @subscribe_arguments end |
Instance Method Details
#action_name_from_routing_key(routing_key) ⇒ Object
90 91 92 93 94 |
# File 'lib/asynk/consumer.rb', line 90 def action_name_from_routing_key(routing_key) splitted = routing_key.split('.') raise 'There now action in routing_key' if splitted.empty? || splitted.count < 2 splitted.last.to_sym end |
#concurrency ⇒ Object
86 87 88 |
# File 'lib/asynk/consumer.rb', line 86 def concurrency @concurrency || Asynk.config[:default_consumer_concurrency] end |
#queue_name ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/asynk/consumer.rb', line 70 def queue_name return @queue_name unless @queue_name.nil? app_name = Rails.application.class.parent_name.dup.underscore if defined?(Rails) queue_name = ActiveSupport::Inflector.underscore(self.name.gsub(/::/, '.')) queue_name = [app_name, queue_name].join('.') if app_name queue_name end |
#route_ending_as_action? ⇒ Boolean
58 59 60 |
# File 'lib/asynk/consumer.rb', line 58 def route_ending_as_action? @route_ending_as_action || false end |
#set_concurrency(size) ⇒ Object
82 83 84 |
# File 'lib/asynk/consumer.rb', line 82 def set_concurrency(size) @concurrency = size end |
#set_consume(*routing_keys) ⇒ Object
50 51 52 |
# File 'lib/asynk/consumer.rb', line 50 def set_consume(*routing_keys) @routing_keys = routing_keys end |
#set_queue_name(options = {}) ⇒ Object
62 63 64 |
# File 'lib/asynk/consumer.rb', line 62 def set_queue_name( = {}) @queue_name = name end |
#set_queue_options(options = {}) ⇒ Object
66 67 68 |
# File 'lib/asynk/consumer.rb', line 66 def ( = {}) @queue_options = end |
#set_route_ending_as_action(value) ⇒ Object
54 55 56 |
# File 'lib/asynk/consumer.rb', line 54 def set_route_ending_as_action(value) @route_ending_as_action = value end |
#set_subscribe_arguments(arguments = {}) ⇒ Object
78 79 80 |
# File 'lib/asynk/consumer.rb', line 78 def set_subscribe_arguments(arguments = {}) @subscribe_arguments = arguments end |