Class: Freddy::MessageHandler
- Inherits:
-
Object
- Object
- Freddy::MessageHandler
- Defined in:
- lib/freddy/message_handler.rb
Instance Attribute Summary collapse
-
#correlation_id ⇒ Object
readonly
Returns the value of attribute correlation_id.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
Instance Method Summary collapse
- #error(error = {error: "Couldn't process message"}) ⇒ Object
-
#initialize(adapter, delivery) ⇒ MessageHandler
constructor
A new instance of MessageHandler.
- #success(response = nil) ⇒ Object
Constructor Details
#initialize(adapter, delivery) ⇒ MessageHandler
Returns a new instance of MessageHandler.
5 6 7 8 9 10 |
# File 'lib/freddy/message_handler.rb', line 5 def initialize(adapter, delivery) @adapter = adapter @properties = delivery.properties @destination = @properties[:destination] @correlation_id = @properties[:correlation_id] end |
Instance Attribute Details
#correlation_id ⇒ Object (readonly)
Returns the value of attribute correlation_id.
3 4 5 |
# File 'lib/freddy/message_handler.rb', line 3 def correlation_id @correlation_id end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
3 4 5 |
# File 'lib/freddy/message_handler.rb', line 3 def destination @destination end |
Instance Method Details
#error(error = {error: "Couldn't process message"}) ⇒ Object
16 17 18 |
# File 'lib/freddy/message_handler.rb', line 16 def error(error = {error: "Couldn't process message"}) @adapter.error(@properties[:reply_to], error) end |
#success(response = nil) ⇒ Object
12 13 14 |
# File 'lib/freddy/message_handler.rb', line 12 def success(response = nil) @adapter.success(@properties[:reply_to], response) end |