Class: ActivePublisher::Async::InMemoryAdapter::ConsumerThread
- Inherits:
-
Object
- Object
- ActivePublisher::Async::InMemoryAdapter::ConsumerThread
- Defined in:
- lib/active_publisher/async/in_memory_adapter/consumer_thread.rb
Constant Summary collapse
- NETWORK_ERRORS =
[::Bunny::NetworkFailure, ::Bunny::TCPConnectionFailed, ::Bunny::ConnectionTimeout, ::Timeout::Error, ::IOError].freeze
- PRECONDITION_ERRORS =
[::Bunny::PreconditionFailed]
Instance Attribute Summary collapse
-
#last_tick_at ⇒ Object
readonly
Returns the value of attribute last_tick_at.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#sampled_queue_size ⇒ Object
readonly
Returns the value of attribute sampled_queue_size.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(listen_queue) ⇒ ConsumerThread
constructor
A new instance of ConsumerThread.
- #kill ⇒ Object
Constructor Details
#initialize(listen_queue) ⇒ ConsumerThread
Returns a new instance of ConsumerThread.
21 22 23 24 25 26 27 |
# File 'lib/active_publisher/async/in_memory_adapter/consumer_thread.rb', line 21 def initialize(listen_queue) @queue = listen_queue @sampled_queue_size = queue.size update_last_tick_at start_thread end |
Instance Attribute Details
#last_tick_at ⇒ Object (readonly)
Returns the value of attribute last_tick_at.
5 6 7 |
# File 'lib/active_publisher/async/in_memory_adapter/consumer_thread.rb', line 5 def last_tick_at @last_tick_at end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
5 6 7 |
# File 'lib/active_publisher/async/in_memory_adapter/consumer_thread.rb', line 5 def queue @queue end |
#sampled_queue_size ⇒ Object (readonly)
Returns the value of attribute sampled_queue_size.
5 6 7 |
# File 'lib/active_publisher/async/in_memory_adapter/consumer_thread.rb', line 5 def sampled_queue_size @sampled_queue_size end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
5 6 7 |
# File 'lib/active_publisher/async/in_memory_adapter/consumer_thread.rb', line 5 def thread @thread end |
Instance Method Details
#alive? ⇒ Boolean
29 30 31 |
# File 'lib/active_publisher/async/in_memory_adapter/consumer_thread.rb', line 29 def alive? @thread && @thread.alive? end |
#kill ⇒ Object
33 34 35 36 |
# File 'lib/active_publisher/async/in_memory_adapter/consumer_thread.rb', line 33 def kill @thread.kill if @thread @thread = nil end |