Esempio n. 1
0
        public static void RegisterHandlerToChannel <T>(this RedisMqHost mqHost, string channel, Func <IMessage <T>, object> processMessageFn, Action <IMessage <T>, Exception> processExceptionEx = null)
        {
            var handlerMap = (Dictionary <Type, IMessageHandlerFactory>)fieldInfo.GetValue(mqHost);

            if (handlerMap.ContainsKey(typeof(T)))
            {
                throw new ArgumentException("Message handler has already been registered for type: " + typeof(T).Name);
            }

            handlerMap[typeof(T)] = mqHost.CreateMessageHandlerFactory(channel, processMessageFn, processExceptionEx);
        }