Exemplo n.º 1
0
        public static IResponse ToResponse(this ApiKey apiKey, IRequestContext context, ArraySegment <byte> bytes)
        {
            switch (apiKey)
            {
            case ApiKey.Produce:
                return(ProduceResponse.FromBytes(context, bytes));

            case ApiKey.Fetch:
                return(FetchResponse.FromBytes(context, bytes));

            case ApiKey.Offsets:
                return(OffsetsResponse.FromBytes(context, bytes));

            case ApiKey.Metadata:
                return(MetadataResponse.FromBytes(context, bytes));

            case ApiKey.OffsetCommit:
                return(OffsetCommitResponse.FromBytes(context, bytes));

            case ApiKey.OffsetFetch:
                return(OffsetFetchResponse.FromBytes(context, bytes));

            case ApiKey.GroupCoordinator:
                return(GroupCoordinatorResponse.FromBytes(context, bytes));

            case ApiKey.JoinGroup:
                return(JoinGroupResponse.FromBytes(context, bytes));

            case ApiKey.Heartbeat:
                return(HeartbeatResponse.FromBytes(context, bytes));

            case ApiKey.LeaveGroup:
                return(LeaveGroupResponse.FromBytes(context, bytes));

            case ApiKey.SyncGroup:
                return(SyncGroupResponse.FromBytes(context, bytes));

            case ApiKey.DescribeGroups:
                return(DescribeGroupsResponse.FromBytes(context, bytes));

            case ApiKey.ListGroups:
                return(ListGroupsResponse.FromBytes(context, bytes));

            case ApiKey.SaslHandshake:
                return(SaslHandshakeResponse.FromBytes(context, bytes));

            case ApiKey.ApiVersions:
                return(ApiVersionsResponse.FromBytes(context, bytes));

            case ApiKey.CreateTopics:
                return(CreateTopicsResponse.FromBytes(context, bytes));

            case ApiKey.DeleteTopics:
                return(DeleteTopicsResponse.FromBytes(context, bytes));

            default:
                throw new NotImplementedException($"Unknown response type {apiKey}");
            }
        }
Exemplo n.º 2
0
 /// <inheritdoc />
 public bool Equals(OffsetCommitResponse other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(responses.HasEqualElementsInOrder(other.responses));
 }