Sha256: 3c3f7d79a9fcd70728513d7c9f5b57d6f2276e9d51676c2ce6a82eb4d3bc3fa6

Contents?: true

Size: 1.94 KB

Versions: 21

Compression:

Stored size: 1.94 KB

Contents

# frozen_string_literal: true

module Kafka
  module Protocol
    class DescribeGroupsResponse
      class Group
        attr_reader :error_code, :group_id, :state, :members, :protocol

        def initialize(error_code:, group_id:, protocol_type:, protocol:, state:, members:)
          @error_code = error_code
          @group_id = group_id
          @protocol_type = protocol_type
          @protocol = protocol
          @state = state
          @members = members
        end
      end

      class Member
        attr_reader :member_id, :client_id, :client_host, :member_assignment

        def initialize(member_id:, client_id:, client_host:, member_assignment:)
          @member_id = member_id
          @client_id = client_id
          @client_host = client_host
          @member_assignment = member_assignment
        end
      end

      attr_reader :error_code, :groups

      def initialize(groups:)
        @groups = groups
      end

      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
            metadata = 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
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ruby-kafka-0.7.3 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.2 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.1.debugcorruption2 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.1.messagecorruptiondebug lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.1 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.1.beta2 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.1.possible.pre.fetch.pre.fix lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.1.beta1 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.0 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.6.8 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.0.beta2 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.0.beta1 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.0.alpha4 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.6.7 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.6.6 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.6.5 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.6.4 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.0.alpha3 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.0.alpha2 lib/kafka/protocol/describe_groups_response.rb
ruby-kafka-0.7.0.alpha1 lib/kafka/protocol/describe_groups_response.rb