tangxu
2022-10-24 1998c849be270159a086cf6d0448a0cdba4db53c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.DataDockingQueueFactory
{
    public sealed partial class DataAccess
    {
        private const string DllName_RabbitMq = "IStation.DataDockingQueue4RabbitMq";//RabbitMq DLL 名称
        private const string DllName_Kafka = "IStation.DataDockingQueue4Kafka";//Kafka DLL 名称
 
        //获取DLL名称
        private static string DllName
        {
            get
            {
                var selector = Settings.Queue.Selector_DataDocking.ToUpper();
                if (selector == Queue.RabbitMq.ToUpper())
                {
                    return DllName_RabbitMq;
                }
                if (selector == Queue.Kafka.ToUpper())
                {
                    return DllName_Kafka;
                }
                return default;
            }
        }
 
        /// <summary>
        /// 创建QUEUE
        /// </summary>
        public static I CreateQueue<I>()
        {
            var type = typeof(I);
            var className = string.Format("{0}.{1}", "IStation.DataDockingQueue", type.Name.Remove(0, 1));
            var obj = Assembly.Load(DllName).CreateInstance(className);
            return (I)obj;
        }
 
 
 
 
 
 
 
 
 
 
    }
}