Пример #1
0
        /// <summary>
        /// Creates a message implementation wrapper based on message type.
        /// </summary>
        /// <param name="messageData"></param>
        /// <returns></returns>
        internal static Message CreateFromData(byte[] messageData)
        {
            FB.Message message = FB.Message.GetRootAsMessage(new ByteBuffer(messageData));

            switch (message.HeaderType)
            {
            case FB.MessageHeader.RecordBatch:
                return(new RecordBatch(message));

            default:
                throw new NotSupportedException($"header type {message.HeaderType} is not supported");
            }
        }
Пример #2
0
 internal RecordBatch(FB.Message fbMessage) : base(fbMessage.BodyLength, fbMessage.HeaderType, fbMessage.Version)
 {
     FB.RecordBatch fb = fbMessage.Header <FB.RecordBatch>().GetValueOrDefault();
     _nodes   = fb.GetNodes();
     _buffers = fb.GetBuffers();
 }