public static void UseAMQP(this Core DomainCore, Func <IAMQP> func, string AMQPType = "RabbitMQ") { if (DomainCore == null) { throw new NullReferenceException(nameof(DomainCore)); } IAMQP amqp = func(); DomainCore.AMQPmodule.AddAMQP(AMQPType, amqp); }
/// <summary> /// 添加AMQP /// </summary> /// <param name="AMQPType">AMQP名称</param> /// <param name="amqp">AMQP客户端</param> /// <returns></returns> public bool AddAMQP(string AMQPType, IAMQP amqp) { if (!AMQP.ContainsKey(AMQPType)) { AMQP.Add(AMQPType, amqp); return(true); } else { return(false); } }