Class: Kafka::Protocol::AlterConfigsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/kafka/protocol/alter_configs_response.rb

Defined Under Namespace

Classes: ResourceDescription

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(throttle_time_ms:, resources:) ⇒ AlterConfigsResponse

Returns a new instance of AlterConfigsResponse.



19
20
21
22
# File 'lib/kafka/protocol/alter_configs_response.rb', line 19

def initialize(throttle_time_ms:, resources:)
  @throttle_time_ms = throttle_time_ms
  @resources = resources
end

Instance Attribute Details

#resourcesObject (readonly)

Returns the value of attribute resources.



17
18
19
# File 'lib/kafka/protocol/alter_configs_response.rb', line 17

def resources
  @resources
end

Class Method Details

.decode(decoder) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kafka/protocol/alter_configs_response.rb', line 24

def self.decode(decoder)
  throttle_time_ms = decoder.int32
  resources = decoder.array do
    error_code = decoder.int16
    error_message = decoder.string

    resource_type = decoder.int8
    if Kafka::Protocol::RESOURCE_TYPES[resource_type].nil?
      raise Kafka::ProtocolError, "Resource type not supported: #{resource_type}"
    end
    resource_name = decoder.string

    ResourceDescription.new(
      type: RESOURCE_TYPES[resource_type],
      name: resource_name,
      error_code: error_code,
      error_message: error_message
    )
  end

  new(throttle_time_ms: throttle_time_ms, resources: resources)
end