Пример #1
0
 /// <inheritdoc />
 public bool Equals(JoinGroupRequest other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(base.Equals(other) &&
            session_timeout.Equals(other.session_timeout) &&
            rebalance_timeout.Equals(other.rebalance_timeout) &&
            string.Equals(group_id, other.group_id) &&
            string.Equals(member_id, other.member_id) &&
            group_protocols.HasEqualElementsInOrder(other.group_protocols));
 }
Пример #2
0
 /// <inheritdoc />
 public bool Equals(JoinGroupRequest other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(base.Equals(other) &&
            SessionTimeout.Equals(other.SessionTimeout) &&
            RebalanceTimeout.Equals(other.RebalanceTimeout) &&
            string.Equals(GroupId, other.GroupId) &&
            string.Equals(MemberId, other.MemberId) &&
            GroupProtocols.HasEqualElementsInOrder(other.GroupProtocols));
 }
Пример #3
0
        private static byte[] EncodeRequest(IRequestContext context, JoinGroupRequest request)
        {
            using (var writer = EncodeHeader(context, request)) {
                writer.Write(request.GroupId)
                .Write((int)request.SessionTimeout.TotalMilliseconds);

                if (context.ApiVersion >= 1)
                {
                    writer.Write((int)request.RebalanceTimeout.TotalMilliseconds);
                }
                writer.Write(request.MemberId)
                .Write(request.ProtocolType)
                .Write(request.GroupProtocols.Count);

                var encoder = context.GetEncoder(request.ProtocolType);
                foreach (var protocol in request.GroupProtocols)
                {
                    writer.Write(protocol.Name)
                    .Write(protocol.Metadata, encoder);
                }

                return(writer.ToBytes());
            }
        }