Class: KubeMQ::CQ::CommandResponseMessage
- Inherits:
-
Object
- Object
- KubeMQ::CQ::CommandResponseMessage
- Defined in:
- lib/kubemq/cq/command_response_message.rb
Overview
Outbound response to a received command, sent via KubeMQ::CQClient#send_response.
Construct from the fields of a CommandReceived — copy id to
request_id and reply_channel — then set #executed and
optionally #error.
Instance Attribute Summary collapse
-
#client_id ⇒ String?
Responder's client identifier.
-
#error ⇒ String?
Error description if execution failed.
-
#executed ⇒ Boolean
Whether the command was executed successfully.
-
#metadata ⇒ String?
Response metadata.
-
#reply_channel ⇒ String
The channel to send the response on.
-
#request_id ⇒ String
The original command's request identifier.
-
#tags ⇒ Hash{String => String}
User-defined key-value tags.
Instance Method Summary collapse
-
#initialize(request_id:, reply_channel:, executed:, error: nil, metadata: nil, tags: nil, client_id: nil) ⇒ CommandResponseMessage
constructor
A new instance of CommandResponseMessage.
Constructor Details
#initialize(request_id:, reply_channel:, executed:, error: nil, metadata: nil, tags: nil, client_id: nil) ⇒ CommandResponseMessage
Returns a new instance of CommandResponseMessage.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/kubemq/cq/command_response_message.rb', line 46 def initialize(request_id:, reply_channel:, executed:, error: nil, metadata: nil, tags: nil, client_id: nil) @request_id = request_id @reply_channel = reply_channel @executed = executed @error = error @metadata = @tags = || {} @client_id = client_id end |
Instance Attribute Details
#client_id ⇒ String?
Returns responder's client identifier.
36 37 |
# File 'lib/kubemq/cq/command_response_message.rb', line 36 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :metadata, :tags |
#error ⇒ String?
Returns error description if execution failed.
36 37 |
# File 'lib/kubemq/cq/command_response_message.rb', line 36 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :metadata, :tags |
#executed ⇒ Boolean
Returns whether the command was executed successfully.
36 37 |
# File 'lib/kubemq/cq/command_response_message.rb', line 36 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :metadata, :tags |
#metadata ⇒ String?
Returns response metadata.
36 37 |
# File 'lib/kubemq/cq/command_response_message.rb', line 36 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :metadata, :tags |
#reply_channel ⇒ String
Returns the channel to send the response on.
36 37 |
# File 'lib/kubemq/cq/command_response_message.rb', line 36 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :metadata, :tags |
#request_id ⇒ String
Returns the original command's request identifier.
36 37 38 |
# File 'lib/kubemq/cq/command_response_message.rb', line 36 def request_id @request_id end |
#tags ⇒ Hash{String => String}
Returns user-defined key-value tags.
36 37 |
# File 'lib/kubemq/cq/command_response_message.rb', line 36 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :metadata, :tags |