Class: KubeMQ::CQ::QueryResponseMessage
- Inherits:
-
Object
- Object
- KubeMQ::CQ::QueryResponseMessage
- Defined in:
- lib/kubemq/cq/query_response_message.rb
Overview
Outbound response to a received query, sent via KubeMQ::CQClient#send_response.
Construct from the fields of a QueryReceived — copy id to
request_id and reply_channel — then set #executed, #body,
and optionally #cache_hit.
Instance Attribute Summary collapse
-
#body ⇒ String?
Response payload.
-
#cache_hit ⇒ Boolean
Whether this response should be cached.
-
#client_id ⇒ String?
Responder's client identifier.
-
#error ⇒ String?
Error description if execution failed.
-
#executed ⇒ Boolean
Whether the query was executed successfully.
-
#metadata ⇒ String?
Response metadata.
-
#reply_channel ⇒ String
The channel to send the response on.
-
#request_id ⇒ String
The original query's request identifier.
-
#tags ⇒ Hash{String => String}
User-defined key-value tags.
Instance Method Summary collapse
-
#initialize(request_id:, reply_channel:, executed:, error: nil, body: nil, metadata: nil, tags: nil, client_id: nil, cache_hit: false) ⇒ QueryResponseMessage
constructor
A new instance of QueryResponseMessage.
Constructor Details
#initialize(request_id:, reply_channel:, executed:, error: nil, body: nil, metadata: nil, tags: nil, client_id: nil, cache_hit: false) ⇒ QueryResponseMessage
Returns a new instance of QueryResponseMessage.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/kubemq/cq/query_response_message.rb', line 53 def initialize(request_id:, reply_channel:, executed:, error: nil, body: nil, metadata: nil, tags: nil, client_id: nil, cache_hit: false) @request_id = request_id @reply_channel = reply_channel @executed = executed @error = error @body = body = = || {} @client_id = client_id @cache_hit = cache_hit end |
Instance Attribute Details
#body ⇒ String?
Returns response payload.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |
#cache_hit ⇒ Boolean
Returns whether this response should be cached.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |
#client_id ⇒ String?
Returns responder's client identifier.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |
#error ⇒ String?
Returns error description if execution failed.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |
#executed ⇒ Boolean
Returns whether the query was executed successfully.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |
#metadata ⇒ String?
Returns response metadata.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |
#reply_channel ⇒ String
Returns the channel to send the response on.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |
#request_id ⇒ String
Returns the original query's request identifier.
41 42 43 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 def request_id @request_id end |
#tags ⇒ Hash{String => String}
Returns user-defined key-value tags.
41 42 |
# File 'lib/kubemq/cq/query_response_message.rb', line 41 attr_accessor :request_id, :reply_channel, :client_id, :executed, :error, :body, :metadata, :tags, :cache_hit |