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;
|
}
|
|
|
|
|
|
|
|
|
|
|
}
|
}
|