Class: KafkaSyrup::Protocol::Request
- Defined in:
- lib/kafka_syrup/protocol/request.rb
Direct Known Subclasses
FetchRequest, MetadataRequest, OffsetRequest, ProduceRequest
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#correlation_id ⇒ Object
Returns the value of attribute correlation_id.
Instance Method Summary collapse
- #api_key ⇒ Object
- #api_version ⇒ Object
- #encode(&block) ⇒ Object
-
#initialize(*args) ⇒ Request
constructor
A new instance of Request.
Methods inherited from Base
#==, #config, #decode, #defaults
Methods included from Utils
Constructor Details
#initialize(*args) ⇒ Request
Returns a new instance of Request.
11 12 13 14 |
# File 'lib/kafka_syrup/protocol/request.rb', line 11 def initialize(*args) load_args(defaults) load_args(*args) end |
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/kafka_syrup/protocol/request.rb', line 6 def api_key @api_key end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
9 10 11 |
# File 'lib/kafka_syrup/protocol/request.rb', line 9 def client_id @client_id end |
#correlation_id ⇒ Object
Returns the value of attribute correlation_id.
9 10 11 |
# File 'lib/kafka_syrup/protocol/request.rb', line 9 def correlation_id @correlation_id end |
Instance Method Details
#api_key ⇒ Object
16 17 18 |
# File 'lib/kafka_syrup/protocol/request.rb', line 16 def api_key self.class.api_key end |
#api_version ⇒ Object
20 21 22 |
# File 'lib/kafka_syrup/protocol/request.rb', line 20 def api_version 0 end |
#encode(&block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kafka_syrup/protocol/request.rb', line 24 def encode(&block) super do [ E.write_int16(api_key), E.write_int16(api_version), E.write_int32(correlation_id.to_i), E.write_string(client_id.to_s), block_given? ? yield : "" ].join end end |