protected override void Parse0(IoBuffer buf)
 {
     Buf = buf;
     var codec = new HermesPrimitiveCodec(buf);
     msgCounter.WriteFullFence(codec.ReadInt());
     Topic = codec.ReadString();
     Partition = codec.ReadInt();
     
 }
 protected override void Parse0(IoBuffer buf)
 {
     HermesPrimitiveCodec codec = new HermesPrimitiveCodec(buf);
     Topic = codec.ReadString();
     Partition = codec.ReadInt();
     GroupId = codec.ReadString();
 }
 protected override void Parse0(IoBuffer buf)
 {
     HermesPrimitiveCodec codec = new HermesPrimitiveCodec(buf);
     m_ackMsgSeqs = readMsgSeqMap(codec);
     m_nackMsgSeqs = readMsgSeqMap(codec);
     Type = codec.ReadInt();
 }
        private void readBatchDatas(IoBuffer buf, HermesPrimitiveCodec codec, List<TppConsumerMessageBatch> batches)
        {
            foreach (TppConsumerMessageBatch batch in batches)
            {
                int len = codec.ReadInt();
                batch.Data = buf.GetSlice(len);
            }

        }
        public PartialDecodedMessage DecodePartial(IoBuffer buf)
        {
            HermesPrimitiveCodec codec = new HermesPrimitiveCodec(buf);

            // skip whole length
            codec.ReadInt();
            // skip header length
            int headerLen = codec.ReadInt();
            // skip body length
            int bodyLen = codec.ReadInt();
            verifyChecksum(buf, headerLen + bodyLen);
            PartialDecodedMessage msg = new PartialDecodedMessage();
            msg.Key = codec.ReadString();
            msg.BornTime = codec.ReadLong();
            msg.RemainingRetries = codec.ReadInt();
            msg.BodyCodecType = codec.ReadString();

            int len = codec.ReadInt();
            msg.DurableProperties = buf.GetSlice(len);

            len = codec.ReadInt();
            msg.VolatileProperties = buf.GetSlice(len);

            msg.Body = buf.GetSlice(bodyLen);

            // skip crc
            codec.ReadLong();

            return msg;
        }
        private void readBatchMetas(HermesPrimitiveCodec codec, List<TppConsumerMessageBatch> batches)
        {
            int batchSize = codec.ReadInt();
            for (int i = 0; i < batchSize; i++)
            {
                TppConsumerMessageBatch batch = new TppConsumerMessageBatch();
                int msgSize = codec.ReadInt();
                batch.Topic = codec.ReadString();
                batch.Partition = codec.ReadInt();
                batch.Priority = codec.ReadInt();
                batch.Resend = codec.ReadBoolean();

                for (int j = 0; j < msgSize; j++)
                {
                    batch.AddMessageMeta(new MessageMeta(codec.ReadLong(), codec.ReadInt(), codec.ReadLong(), codec.ReadInt(),
                            codec.ReadBoolean()));
                }
                batches.Add(batch);
            }
        }
 protected override void Parse0(IoBuffer buf)
 {
     var codec = new HermesPrimitiveCodec(buf);
     totalSize = codec.ReadInt();
     Successes = codec.ReadIntBooleanMap();
 }
        private ConcurrentDictionary<Triple<Tpp, string, bool>, List<AckContext>> readMsgSeqMap(HermesPrimitiveCodec codec)
        {
            ConcurrentDictionary<Triple<Tpp, string, bool>, List<AckContext>> msgSeqMap = new ConcurrentDictionary<Triple<Tpp, string, bool>, List<AckContext>>();

            int mapSize = codec.ReadInt();
            if (mapSize != 0)
            {
                List<Triple<Tpp, string, bool>> tppgrs = new List<Triple<Tpp, string, bool>>();
                for (int i = 0; i < mapSize; i++)
                {
                    Tpp tpp = new Tpp(codec.ReadString(), codec.ReadInt(), codec.ReadInt() == 0 ? true : false);
                    String groupId = codec.ReadString();
                    bool resend = codec.ReadBoolean();
                    tppgrs.Add(new Triple<Tpp, string, bool>(tpp, groupId, resend));
                }
                for (int i = 0; i < mapSize; i++)
                {
                    Triple<Tpp, string, bool> tppgr = tppgrs[i];

                    int len = codec.ReadInt();
                    if (len == 0)
                    {
                        msgSeqMap[tppgr] = new List<AckContext>();
                    }
                    else
                    {
                        msgSeqMap[tppgr] = new List<AckContext>(len);
                    }

                    for (int j = 0; j < len; j++)
                    {
                        msgSeqMap[tppgr].Add(new AckContext(codec.ReadLong(), codec.ReadInt(), codec.ReadLong(), codec.ReadLong()));
                    }
                }
            }

            return msgSeqMap;
        }
 /// <summary>
 /// Read Datas
 /// </summary>
 /// <param name="buf"></param>
 /// <param name="codec"></param>
 /// <param name="topic"></param>
 /// <remarks>
 /// implements only in broker
 /// </remarks>
 private void ReadDatas(ByteBuffer buf, HermesPrimitiveCodec codec, string topic)
 {
     var size = codec.ReadInt();
     for (int i = 0; i < size; i++)
     {
         var priority = codec.ReadInt();
         //todo
     }
 }