private static IPooledBuffer Serialize(IInvocationStartRequested message, Nothing _)
 {
     using (var envelope = BrokerToClientRequestEnvelope.Rent())
     {
         var obj = InvocationStartRequested.Rent();
         obj.MethodId                      = message.MethodId.ConvertToProtoStrict();
         obj.ServiceId                     = message.ServiceId.ConvertToProtoStrict();
         obj.ServiceAlias                  = message.ServiceAlias.ConvertToProto();
         obj.ConsumerApplicationId         = message.ConsumerApplicationId.ConvertToProtoStrict();
         obj.ConsumerConnectionId          = obj.ConsumerConnectionId.MergeFrom(message.ConsumerConnectionId);
         envelope.InvocationStartRequested = obj;
         return(envelope.Serialize());
     }
 }
        public IBrokerToClientRequest DeserializeBrokerToClientRequest(IPooledBuffer message)
        {
            using (var envelope = BrokerToClientRequestEnvelope.Rent())
            {
                envelope.MergeFrom(message);
                switch (envelope.PayloadCase)
                {
                case BrokerToClientRequestEnvelope.PayloadOneofCase.InvocationStartRequested:
                    var msg = envelope.InvocationStartRequested;
                    return(_messageFactory.CreateInvocationStartRequested(
                               msg.ServiceId.ConvertFromProtoStrict(),
                               msg.MethodId.ConvertFromProtoStrict(),
                               msg.ServiceAlias.ConvertFromProto(),
                               msg.ConsumerApplicationId.ConvertFromProtoStrict(),
                               msg.ConsumerConnectionId.ConvertFromProtoStrict()));

                default:
                    throw new InvalidOperationException();
                }
            }
        }