Ejemplo n.º 1
0
        public static T TypedDeserialize <T>(this IRabbitSerializer source, byte[] data, IBasicProperties properties)
        {
            properties.Type.AssertNotNullOrEmpty("The message property 'Type' must have a qualified type name");

            var expectedType = Type.GetType(properties.Type);

            return((T)source.Deserialize(data, expectedType, properties));
        }
Ejemplo n.º 2
0
        private void HandleError(MessageEnvelope reply)
        {
            if (reply.Body == null || reply.Body.Length == 0)
            {
                throw new Exception("Call failed");
            }

            // Note: ErrorResponse infra does not add the
            //       type name to properties, so we cannot call .TypedDeserialize()
            var response = (ErrorResponse)_serializer.Deserialize(reply.Body, typeof(ErrorResponse), reply.Properties);

            throw response.Exception;
        }