Class: Kafka::Protocol::DescribeGroupsResponse

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

Defined Under Namespace

Classes: Group, Member

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(groups:) ⇒ DescribeGroupsResponse

Returns a new instance of DescribeGroupsResponse


32
33
34
# File 'lib/kafka/protocol/describe_groups_response.rb', line 32

def initialize(groups:)
  @groups = groups
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code


30
31
32
# File 'lib/kafka/protocol/describe_groups_response.rb', line 30

def error_code
  @error_code
end

#groupsObject (readonly)

Returns the value of attribute groups


30
31
32
# File 'lib/kafka/protocol/describe_groups_response.rb', line 30

def groups
  @groups
end

Class Method Details

.decode(decoder) ⇒ Object


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/kafka/protocol/describe_groups_response.rb', line 36

def self.decode(decoder)
  groups = decoder.array do
    error_code = decoder.int16
    group_id = decoder.string
    state = decoder.string
    protocol_type = decoder.string
    protocol = decoder.string

    members = decoder.array do
      member_id = decoder.string
      client_id = decoder.string
      client_host = decoder.string
       = decoder.bytes
      assignment = MemberAssignment.decode(Decoder.from_string(decoder.bytes))

      Member.new(
        member_id: member_id,
        client_id: client_id,
        client_host: client_host,
        member_assignment: assignment
      )
    end

    Group.new(
      error_code: error_code,
      group_id: group_id,
      state: state,
      protocol_type: protocol_type,
      protocol: protocol,
      members: members
    )
  end

  new(groups: groups)
end