EventDeclare CreateEventDeclare(SubscribeAttribute attr, MethodInfo method)
        {
            var key   = attr?.Name;
            var func  = Core.DynamicMethodHelper.CreateMethodInvoker(method);
            var args1 = method.GetParameters().FirstOrDefault();

            if (args1 == null)
            {
                throw new Exception("至少一个参数");
            }
            var eventDataType = args1.ParameterType;

            if (string.IsNullOrEmpty(key))
            {
                throw new Exception("name不能为空");
            }
            var isArry  = typeof(System.Collections.IEnumerable).IsAssignableFrom(eventDataType);
            var isAsync = method.ReturnType == typeof(Task);

            var ed = new EventDeclare()
            {
                EventDataType     = eventDataType,
                Name              = key,
                MethodInvoke      = func,
                IsAsync           = isAsync,
                IsArray           = isArry,
                ListTake          = attr.ListTake,
                QueueName         = attr.QueueName,
                ThreadSleepSecond = attr.ThreadSleepSecond
            };

            return(ed);
        }
        EventDeclare CreateEventDeclare <T>(SubscribeAttribute attr, Func <object, object[], object> func)
        {
            var key           = attr?.Name;
            var eventDataType = typeof(T);

            if (string.IsNullOrEmpty(key))
            {
                throw new Exception("name不能为空");
            }
            var isArry = typeof(System.Collections.IEnumerable).IsAssignableFrom(eventDataType);

            var ed = new EventDeclare()
            {
                EventDataType = eventDataType,
                Name          = key,
                MethodInvoke  = func,
                //IsAsync = isAsync,
                IsArray           = isArry,
                ListTake          = attr.ListTake,
                QueueName         = attr.QueueName,
                ThreadSleepSecond = attr.ThreadSleepSecond
            };

            return(ed);
        }
        public static AbsQueue GetQueueClient(QueueConfig config, EventDeclare eventDeclare)
        {
            var _queueName = config.QueueName;
            var key        = $"CRL_{_queueName}_{eventDeclare.IsAsync}";
            var a          = clients.TryGetValue(key, out AbsQueue client);

            if (!a)
            {
                client = CreateClient(config, eventDeclare.IsAsync);
                clients.TryAdd(key, client);
            }
            return(client);
        }