Class: Leveret::DelayQueue
- Inherits:
-
Object
- Object
- Leveret::DelayQueue
- Extended by:
- Forwardable
- Defined in:
- lib/leveret/delay_queue.rb
Overview
Connects to a special queue which keeps messages in a holding pattern until a timeout expires and then publishes those messages back to the main queue for processing.
Instance Attribute Summary collapse
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
-
#initialize ⇒ DelayQueue
constructor
A new instance of DelayQueue.
-
#republish(message) ⇒ Object
Place a message onto the delay queue, which will later be expired and sent back to the main exchange.
Constructor Details
#initialize ⇒ DelayQueue
Returns a new instance of DelayQueue.
11 12 13 |
# File 'lib/leveret/delay_queue.rb', line 11 def initialize @queue = connect_to_queue end |
Instance Attribute Details
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
7 8 9 |
# File 'lib/leveret/delay_queue.rb', line 7 def queue @queue end |
Instance Method Details
#republish(message) ⇒ Object
Place a message onto the delay queue, which will later be expired and sent back to the main exchange
18 19 20 21 |
# File 'lib/leveret/delay_queue.rb', line 18 def republish() delay_exchange.publish(.params.serialize, expiration: configuration.delay_time, persistent: true, routing_key: .routing_key, priority: .priority) end |