Example #1
0
        protected virtual string DefaultSubscriptionIdGenerator(ConsumerInfo c)
        {
            var r      = new StringBuilder();
            var unique = string.Concat(SubscriptionIdPrefix, ":", c.ConcreteType.FullName, ":", c.MessageType.FullName);

            using (var md5 = MD5.Create())
            {
                var buff = md5.ComputeHash(Encoding.UTF8.GetBytes(unique));
                foreach (var b in buff)
                {
                    r.Append(b.ToString("x2"));
                }
            }

            return(string.Concat(SubscriptionIdPrefix, ":", r.ToString()));
        }
Example #2
0
        protected virtual ConsumerAttribute GetSubscriptionAttribute(ConsumerInfo consumerInfo)
        {
            var consumeMethod = consumerInfo.ConcreteType.GetMethod(ConsumeMethodName, new[] { consumerInfo.MessageType });

            return consumeMethod.GetCustomAttributes(typeof(ConsumerAttribute), true).SingleOrDefault() as ConsumerAttribute;
        }
Example #3
0
        protected virtual string DefaultSubscriptionIdGenerator(ConsumerInfo c)
        {
            var r = new StringBuilder();
            var unique = string.Concat(SubscriptionIdPrefix, ":", c.ConcreteType.FullName, ":", c.MessageType.FullName);

            using (var md5 = MD5.Create())
            {
                var buff = md5.ComputeHash(Encoding.UTF8.GetBytes(unique));
                foreach (var b in buff)
                    r.Append(b.ToString("x2"));
            }

            return string.Concat(SubscriptionIdPrefix, ":", r.ToString());
        }
Example #4
0
        protected virtual ConsumerAttribute GetSubscriptionAttribute(ConsumerInfo consumerInfo)
        {
            var consumeMethod = consumerInfo.ConcreteType.GetMethod(ConsumeMethodName, new[] { consumerInfo.MessageType });

            return(consumeMethod.GetCustomAttributes(typeof(ConsumerAttribute), true).SingleOrDefault() as ConsumerAttribute);
        }
Example #5
0
 protected virtual MethodInfo GetConsumeMethodFor(ConsumerInfo subscriptionInfo)
 {
     return(subscriptionInfo.ConcreteType.GetMethod(ConsumeMethodName, new[] { subscriptionInfo.MessageType }));
 }