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)); }
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; }