예제 #1
0
        public QueueMessageHandle <TMessage> As <TMessage>() where TMessage : IEventBusMessage
        {
            if (RawMessage.IsEmpty())
            {
                return(null);
            }

            try
            {
                var message = JsonConvert.DeserializeObject <TMessage>(RawMessage);
                return(new QueueMessageHandle <TMessage>(RawMessage, MessageId, message, Complete));
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to deserialize event message to " + typeof(TMessage).FullName + ":\r\n" + RawMessage, ex);
            }
        }