Class: KubeMQ::CQ::CommandReceived
- Inherits:
-
Object
- Object
- KubeMQ::CQ::CommandReceived
- Defined in:
- lib/kubemq/cq/command_received.rb
Overview
A command received by a subscriber via KubeMQ::CQClient#subscribe_to_commands.
After processing, use the #reply_channel and #id to construct a CommandResponseMessage and send it back via KubeMQ::CQClient#send_response.
Instance Attribute Summary collapse
-
#body ⇒ String
readonly
Command payload (binary).
-
#channel ⇒ String
readonly
The channel the command was sent to.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#id ⇒ String
readonly
Request identifier (use as
request_idin the response). -
#metadata ⇒ String
readonly
Command metadata.
-
#reply_channel ⇒ String
readonly
Channel to send the response back on.
-
#tags ⇒ Hash{String => String}
readonly
User-defined key-value tags.
-
#timeout ⇒ Integer
readonly
Original timeout from the sender (milliseconds).
Instance Method Summary collapse
-
#initialize(id:, channel:, metadata:, body:, reply_channel:, tags:, timeout: 0, client_id: nil, **_) ⇒ CommandReceived
constructor
A new instance of CommandReceived.
Constructor Details
#initialize(id:, channel:, metadata:, body:, reply_channel:, tags:, timeout: 0, client_id: nil, **_) ⇒ CommandReceived
Returns a new instance of CommandReceived.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/kubemq/cq/command_received.rb', line 40 def initialize(id:, channel:, metadata:, body:, reply_channel:, tags:, timeout: 0, client_id: nil, **_) @id = id @channel = channel @metadata = @body = body @reply_channel = reply_channel @tags = || {} @timeout = timeout @client_id = client_id end |
Instance Attribute Details
#body ⇒ String (readonly)
Returns command payload (binary).
30 |
# File 'lib/kubemq/cq/command_received.rb', line 30 attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id |
#channel ⇒ String (readonly)
Returns the channel the command was sent to.
30 |
# File 'lib/kubemq/cq/command_received.rb', line 30 attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
30 |
# File 'lib/kubemq/cq/command_received.rb', line 30 attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id |
#id ⇒ String (readonly)
Returns request identifier (use as request_id in the response).
30 31 32 |
# File 'lib/kubemq/cq/command_received.rb', line 30 def id @id end |
#metadata ⇒ String (readonly)
Returns command metadata.
30 |
# File 'lib/kubemq/cq/command_received.rb', line 30 attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id |
#reply_channel ⇒ String (readonly)
Returns channel to send the response back on.
30 |
# File 'lib/kubemq/cq/command_received.rb', line 30 attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id |
#tags ⇒ Hash{String => String} (readonly)
Returns user-defined key-value tags.
30 |
# File 'lib/kubemq/cq/command_received.rb', line 30 attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id |
#timeout ⇒ Integer (readonly)
Returns original timeout from the sender (milliseconds).
30 |
# File 'lib/kubemq/cq/command_received.rb', line 30 attr_reader :id, :channel, :metadata, :body, :reply_channel, :tags, :timeout, :client_id |