Example #1
0
        public static IRoutableMessage CreateMessage <T>(T message, string sender, string recipient) where T : class
        {
            string           data = JsonConvert.SerializeObject(message);
            IRoutableMessage msg  = new RoutableMessage(data, typeof(T).ToString(), sender, recipient);

            return(msg);
        }
Example #2
0
        public static IRoutableMessage BusTopicMessage(this object message, string sender, string recipient)
        {
            string           data = JsonConvert.SerializeObject(message);
            IRoutableMessage msg  = new RoutableMessage(data, message.GetType().ToString(), sender, recipient);

            return(msg);
        }
Example #3
0
        /// <summary>
        /// Helper method used to create a response message to the original sender.
        /// The sender, recipient and CorrelationId are properly set.
        /// </summary>
        /// <param name="payloadContent">content of message payload</param>
        /// <param name="payloadType">specifies the type of payload</param>
        /// <returns>Fully formed RoutableMessage ready to send</returns>
        public IRoutableMessage CreateResponse(string payloadContent, string payloadType)
        {
            RoutableMessage response = new RoutableMessage(payloadContent, payloadType, Recipient, Sender);

            response.CorrelationId = CorrelationId;
            response.TimeSent      = DateTime.Now;
            return(response);
        }