Class: Freddy::RequestManager
- Inherits:
-
Object
- Object
- Freddy::RequestManager
- Defined in:
- lib/freddy/request_manager.rb
Defined Under Namespace
Classes: ConcurrentHash
Instance Method Summary collapse
- #delete(correlation_id) ⇒ Object
-
#initialize(logger) ⇒ RequestManager
constructor
A new instance of RequestManager.
- #no_route(correlation_id) ⇒ Object
- #store(correlation_id, opts) ⇒ Object
Constructor Details
#initialize(logger) ⇒ RequestManager
Returns a new instance of RequestManager.
3 4 5 6 |
# File 'lib/freddy/request_manager.rb', line 3 def initialize(logger) @requests = ConcurrentHash.new @logger = logger end |
Instance Method Details
#delete(correlation_id) ⇒ Object
19 20 21 |
# File 'lib/freddy/request_manager.rb', line 19 def delete(correlation_id) @requests.delete(correlation_id) end |
#no_route(correlation_id) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/freddy/request_manager.rb', line 8 def no_route(correlation_id) if request = @requests[correlation_id] delete(correlation_id) request[:callback].call({error: 'Specified queue does not exist'}, nil) end end |
#store(correlation_id, opts) ⇒ Object
15 16 17 |
# File 'lib/freddy/request_manager.rb', line 15 def store(correlation_id, opts) @requests[correlation_id] = opts end |