Class: AceMQ::Rails::Configuration::ConsumerDefaults
- Inherits:
-
Object
- Object
- AceMQ::Rails::Configuration::ConsumerDefaults
- Defined in:
- lib/acemq/rails/configuration.rb
Overview
Consumer settings that apply unless a consumer class says otherwise.
Instance Attribute Summary collapse
-
#broker_wait_threshold ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process.
-
#concurrency ⇒ Object
Messages worked on at once by one consumer.
-
#give_up_after ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process.
-
#initial_delay ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process.
-
#jitter ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process.
-
#max_attempts ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process.
-
#max_delay ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process.
-
#multiplier ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process.
-
#prefetch ⇒ Object
Unacknowledged messages a consumer holds at once.
Instance Method Summary collapse
- #assign(settings) ⇒ Object private
-
#initialize ⇒ ConsumerDefaults
constructor
A new instance of ConsumerDefaults.
-
#retry_policy ⇒ Object
The library's RetryPolicy these settings describe.
Constructor Details
#initialize ⇒ ConsumerDefaults
Returns a new instance of ConsumerDefaults.
214 215 216 217 218 219 220 221 222 |
# File 'lib/acemq/rails/configuration.rb', line 214 def initialize @prefetch = AceMQ::AMQP::Connection::DEFAULT_PREFETCH @concurrency = 1 @max_attempts = 1 @initial_delay = 0.0 @max_delay = 0.0 @multiplier = 2.0 @broker_wait_threshold = AceMQ::AMQP::RetryLadder::DEFAULT_THRESHOLD end |
Instance Attribute Details
#broker_wait_threshold ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process. That last one is a shutdown setting as much as a reliability one — a wait held here is a wait a drain has to sit through. See docs/lifecycle.md.
211 212 213 |
# File 'lib/acemq/rails/configuration.rb', line 211 def broker_wait_threshold @broker_wait_threshold end |
#concurrency ⇒ Object
Messages worked on at once by one consumer. One keeps a queue's messages in the order the broker offers them; raising it trades that order for throughput.
204 205 206 |
# File 'lib/acemq/rails/configuration.rb', line 204 def concurrency @concurrency end |
#give_up_after ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process. That last one is a shutdown setting as much as a reliability one — a wait held here is a wait a drain has to sit through. See docs/lifecycle.md.
211 212 213 |
# File 'lib/acemq/rails/configuration.rb', line 211 def give_up_after @give_up_after end |
#initial_delay ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process. That last one is a shutdown setting as much as a reliability one — a wait held here is a wait a drain has to sit through. See docs/lifecycle.md.
211 212 213 |
# File 'lib/acemq/rails/configuration.rb', line 211 def initial_delay @initial_delay end |
#jitter ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process. That last one is a shutdown setting as much as a reliability one — a wait held here is a wait a drain has to sit through. See docs/lifecycle.md.
211 212 213 |
# File 'lib/acemq/rails/configuration.rb', line 211 def jitter @jitter end |
#max_attempts ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process. That last one is a shutdown setting as much as a reliability one — a wait held here is a wait a drain has to sit through. See docs/lifecycle.md.
211 212 213 |
# File 'lib/acemq/rails/configuration.rb', line 211 def max_attempts @max_attempts end |
#max_delay ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process. That last one is a shutdown setting as much as a reliability one — a wait held here is a wait a drain has to sit through. See docs/lifecycle.md.
211 212 213 |
# File 'lib/acemq/rails/configuration.rb', line 211 def max_delay @max_delay end |
#multiplier ⇒ Object
The retry ladder: how many attempts, the first delay, the ceiling, and the point past which a wait is spent on a broker queue rather than in this process. That last one is a shutdown setting as much as a reliability one — a wait held here is a wait a drain has to sit through. See docs/lifecycle.md.
211 212 213 |
# File 'lib/acemq/rails/configuration.rb', line 211 def multiplier @multiplier end |
#prefetch ⇒ Object
Unacknowledged messages a consumer holds at once.
199 200 201 |
# File 'lib/acemq/rails/configuration.rb', line 199 def prefetch @prefetch end |
Instance Method Details
#assign(settings) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
240 241 242 243 |
# File 'lib/acemq/rails/configuration.rb', line 240 def assign(settings) settings.each { |key, value| writer(key, value) } self end |
#retry_policy ⇒ Object
The library's RetryPolicy these settings describe.
225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/acemq/rails/configuration.rb', line 225 def retry_policy return AceMQ::AMQP::RetryPolicy.none if max_attempts.to_i <= 1 policy = AceMQ::AMQP::RetryPolicy.new( max_attempts: max_attempts.to_i, initial_delay: initial_delay.to_f, multiplier: multiplier.to_f, max_delay: max_delay.to_f ) policy = policy.give_up_after(give_up_after.to_f) if give_up_after policy = policy.with_jitter(jitter.to_f) if jitter policy end |